diff --git a/.travis.yml b/.travis.yml index 629efb1de..e9ed8841e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ services: - docker script: + - make gofmt-verify - make image -e - if [ "$TRAVIS_BRANCH" == master -a -n "$IMAGE_REPO_USER" ]; then set -e; diff --git a/Makefile b/Makefile index 10ea75abd..1d046bd13 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ .FORCE: GO_CMD := go +GO_FMT := gofmt IMAGE_BUILD_CMD := docker build IMAGE_BUILD_EXTRA_OPTS := @@ -44,6 +45,17 @@ mock: mockery --name=APIHelpers --dir=pkg/apihelper --inpkg --note="Re-generate by running 'make mock'" mockery --name=LabelerClient --dir=pkg/labeler --inpkg --note="Re-generate by running 'make mock'" +gofmt: + @$(GO_FMT) -w -l $$(find . -name '*.go') + +gofmt-verify: + @out=`$(GO_FMT) -l -d $$(find . -name '*.go')`; \ + if [ -n "$$out" ]; then \ + echo "$$out"; \ + exit 1; \ + fi + + test: $(GO_CMD) test ./cmd/... ./pkg/... diff --git a/source/cpu/cpuid_ppc64le.go b/source/cpu/cpuid_ppc64le.go index db5f49229..307739717 100644 --- a/source/cpu/cpuid_ppc64le.go +++ b/source/cpu/cpuid_ppc64le.go @@ -31,35 +31,35 @@ import "C" /* all special features for ppc64le should be defined here */ const ( /* AT_HWCAP features */ - PPC_FEATURE_32 = 0x80000000 /* 32-bit mode. */ - PPC_FEATURE_64 = 0x40000000 /* 64-bit mode. */ - PPC_FEATURE_601_INSTR = 0x20000000 /* 601 chip, Old POWER ISA. */ - PPC_FEATURE_HAS_ALTIVEC = 0x10000000 /* SIMD/Vector Unit. */ - PPC_FEATURE_HAS_FPU = 0x08000000 /* Floating Point Unit. */ - PPC_FEATURE_HAS_MMU = 0x04000000 /* Memory Management Unit. */ - PPC_FEATURE_HAS_4xxMAC = 0x02000000 /* 4xx Multiply Accumulator. */ - PPC_FEATURE_UNIFIED_CACHE = 0x01000000 /* Unified I/D cache. */ - PPC_FEATURE_HAS_SPE = 0x00800000 /* Signal Processing ext. */ - PPC_FEATURE_HAS_EFP_SINGLE = 0x00400000 /* SPE Float. */ - PPC_FEATURE_HAS_EFP_DOUBLE = 0x00200000 /* SPE Double. */ - PPC_FEATURE_NO_TB = 0x00100000 /* 601/403gx have no timebase */ - PPC_FEATURE_POWER4 = 0x00080000 /* POWER4 ISA 2.00 */ - PPC_FEATURE_POWER5 = 0x00040000 /* POWER5 ISA 2.02 */ - PPC_FEATURE_POWER5_PLUS = 0x00020000 /* POWER5+ ISA 2.03 */ - PPC_FEATURE_CELL_BE = 0x00010000 /* CELL Broadband Engine */ - PPC_FEATURE_BOOKE = 0x00008000 /* ISA Category Embedded */ - PPC_FEATURE_SMT = 0x00004000 /* Simultaneous Multi-Threading */ - PPC_FEATURE_ICACHE_SNOOP = 0x00002000 - PPC_FEATURE_ARCH_2_05 = 0x00001000 /* ISA 2.05 */ - PPC_FEATURE_PA6T = 0x00000800 /* PA Semi 6T Core */ - PPC_FEATURE_HAS_DFP = 0x00000400 /* Decimal FP Unit */ - PPC_FEATURE_POWER6_EXT = 0x00000200 /* P6 + mffgpr/mftgpr */ - PPC_FEATURE_ARCH_2_06 = 0x00000100 /* ISA 2.06 */ - PPC_FEATURE_HAS_VSX = 0x00000080 /* P7 Vector Extension. */ - PPC_FEATURE_PSERIES_PERFMON_COMPAT = 0x00000040 + PPC_FEATURE_32 = 0x80000000 /* 32-bit mode. */ + PPC_FEATURE_64 = 0x40000000 /* 64-bit mode. */ + PPC_FEATURE_601_INSTR = 0x20000000 /* 601 chip, Old POWER ISA. */ + PPC_FEATURE_HAS_ALTIVEC = 0x10000000 /* SIMD/Vector Unit. */ + PPC_FEATURE_HAS_FPU = 0x08000000 /* Floating Point Unit. */ + PPC_FEATURE_HAS_MMU = 0x04000000 /* Memory Management Unit. */ + PPC_FEATURE_HAS_4xxMAC = 0x02000000 /* 4xx Multiply Accumulator. */ + PPC_FEATURE_UNIFIED_CACHE = 0x01000000 /* Unified I/D cache. */ + PPC_FEATURE_HAS_SPE = 0x00800000 /* Signal Processing ext. */ + PPC_FEATURE_HAS_EFP_SINGLE = 0x00400000 /* SPE Float. */ + PPC_FEATURE_HAS_EFP_DOUBLE = 0x00200000 /* SPE Double. */ + PPC_FEATURE_NO_TB = 0x00100000 /* 601/403gx have no timebase */ + PPC_FEATURE_POWER4 = 0x00080000 /* POWER4 ISA 2.00 */ + PPC_FEATURE_POWER5 = 0x00040000 /* POWER5 ISA 2.02 */ + PPC_FEATURE_POWER5_PLUS = 0x00020000 /* POWER5+ ISA 2.03 */ + PPC_FEATURE_CELL_BE = 0x00010000 /* CELL Broadband Engine */ + PPC_FEATURE_BOOKE = 0x00008000 /* ISA Category Embedded */ + PPC_FEATURE_SMT = 0x00004000 /* Simultaneous Multi-Threading */ + PPC_FEATURE_ICACHE_SNOOP = 0x00002000 + PPC_FEATURE_ARCH_2_05 = 0x00001000 /* ISA 2.05 */ + PPC_FEATURE_PA6T = 0x00000800 /* PA Semi 6T Core */ + PPC_FEATURE_HAS_DFP = 0x00000400 /* Decimal FP Unit */ + PPC_FEATURE_POWER6_EXT = 0x00000200 /* P6 + mffgpr/mftgpr */ + PPC_FEATURE_ARCH_2_06 = 0x00000100 /* ISA 2.06 */ + PPC_FEATURE_HAS_VSX = 0x00000080 /* P7 Vector Extension. */ + PPC_FEATURE_PSERIES_PERFMON_COMPAT = 0x00000040 /* Reserved by the kernel. 0x00000004 Do not use. */ - PPC_FEATURE_TRUE_LE = 0x00000002 - PPC_FEATURE_PPC_LE = 0x00000001 + PPC_FEATURE_TRUE_LE = 0x00000002 + PPC_FEATURE_PPC_LE = 0x00000001 ) const ( @@ -70,7 +70,7 @@ const ( PPC_FEATURE2_HAS_EBB = 0x10000000 /* Event Base Branching */ PPC_FEATURE2_HAS_ISEL = 0x08000000 /* Integer Select */ PPC_FEATURE2_HAS_TAR = 0x04000000 /* Target Address Register */ - PPC_FEATURE2_HAS_VEC_CRYPTO = 0x02000000 /* Target supports vector instruction. */ + PPC_FEATURE2_HAS_VEC_CRYPTO = 0x02000000 /* Target supports vector instruction. */ PPC_FEATURE2_HTM_NOSC = 0x01000000 /* Kernel aborts transaction when a syscall is made. */ PPC_FEATURE2_ARCH_3_00 = 0x00800000 /* ISA 3.0 */ PPC_FEATURE2_HAS_IEEE128 = 0x00400000 /* VSX IEEE Binary Float 128-bit */ @@ -80,34 +80,34 @@ const ( ) var flagNames_ppc64le = map[uint64]string{ - PPC_FEATURE_32: "PPC32", - PPC_FEATURE_64: "PPC64", - PPC_FEATURE_601_INSTR: "PPC601", - PPC_FEATURE_HAS_ALTIVEC: "ALTIVEC", - PPC_FEATURE_HAS_FPU: "FPU", - PPC_FEATURE_HAS_MMU: "MMU", - PPC_FEATURE_HAS_4xxMAC: "4xxMAC", - PPC_FEATURE_UNIFIED_CACHE: "UCACHE", - PPC_FEATURE_HAS_SPE: "SPE", - PPC_FEATURE_HAS_EFP_SINGLE: "EFPFLOAT", - PPC_FEATURE_HAS_EFP_DOUBLE: "EFPDOUBLE", - PPC_FEATURE_NO_TB: "NOTB", - PPC_FEATURE_POWER4: "POWER4", - PPC_FEATURE_POWER5: "POWER5", - PPC_FEATURE_POWER5_PLUS: "POWER5+", - PPC_FEATURE_CELL_BE: "CELLBE", - PPC_FEATURE_BOOKE: "BOOKE", - PPC_FEATURE_SMT: "SMT", - PPC_FEATURE_ICACHE_SNOOP: "IC_SNOOP", - PPC_FEATURE_ARCH_2_05: "ARCH_2_05", - PPC_FEATURE_PA6T: "PA6T", - PPC_FEATURE_HAS_DFP: "DFP", - PPC_FEATURE_POWER6_EXT: "POWER6X", - PPC_FEATURE_ARCH_2_06: "ARCH_2_06", - PPC_FEATURE_HAS_VSX: "VSX", - PPC_FEATURE_PSERIES_PERFMON_COMPAT: "ARCHPMU", - PPC_FEATURE_TRUE_LE: "TRUE_LE", - PPC_FEATURE_PPC_LE: "PPCLE", + PPC_FEATURE_32: "PPC32", + PPC_FEATURE_64: "PPC64", + PPC_FEATURE_601_INSTR: "PPC601", + PPC_FEATURE_HAS_ALTIVEC: "ALTIVEC", + PPC_FEATURE_HAS_FPU: "FPU", + PPC_FEATURE_HAS_MMU: "MMU", + PPC_FEATURE_HAS_4xxMAC: "4xxMAC", + PPC_FEATURE_UNIFIED_CACHE: "UCACHE", + PPC_FEATURE_HAS_SPE: "SPE", + PPC_FEATURE_HAS_EFP_SINGLE: "EFPFLOAT", + PPC_FEATURE_HAS_EFP_DOUBLE: "EFPDOUBLE", + PPC_FEATURE_NO_TB: "NOTB", + PPC_FEATURE_POWER4: "POWER4", + PPC_FEATURE_POWER5: "POWER5", + PPC_FEATURE_POWER5_PLUS: "POWER5+", + PPC_FEATURE_CELL_BE: "CELLBE", + PPC_FEATURE_BOOKE: "BOOKE", + PPC_FEATURE_SMT: "SMT", + PPC_FEATURE_ICACHE_SNOOP: "IC_SNOOP", + PPC_FEATURE_ARCH_2_05: "ARCH_2_05", + PPC_FEATURE_PA6T: "PA6T", + PPC_FEATURE_HAS_DFP: "DFP", + PPC_FEATURE_POWER6_EXT: "POWER6X", + PPC_FEATURE_ARCH_2_06: "ARCH_2_06", + PPC_FEATURE_HAS_VSX: "VSX", + PPC_FEATURE_PSERIES_PERFMON_COMPAT: "ARCHPMU", + PPC_FEATURE_TRUE_LE: "TRUE_LE", + PPC_FEATURE_PPC_LE: "PPCLE", } var flag2Names_ppc64le = map[uint64]string{ diff --git a/source/cpu/cpuid_s390x.go b/source/cpu/cpuid_s390x.go index bab102a76..fbd47098d 100644 --- a/source/cpu/cpuid_s390x.go +++ b/source/cpu/cpuid_s390x.go @@ -28,47 +28,47 @@ import "C" /* all special features for s390x should be defined here */ const ( /* AT_HWCAP features */ - HWCAP_S390_ESAN3 = 1 - HWCAP_S390_ZARCH = 2 - HWCAP_S390_STFLE = 4 - HWCAP_S390_MSA = 8 - HWCAP_S390_LDISP = 16 - HWCAP_S390_EIMM = 32 - HWCAP_S390_DFP = 64 - HWCAP_S390_HPAGE = 128 - HWCAP_S390_ETF3EH = 256 - HWCAP_S390_HIGH_GPRS = 512 - HWCAP_S390_TE = 1024 - HWCAP_S390_VX = 2048 - HWCAP_S390_VXD = 4096 - HWCAP_S390_VXE = 8192 - HWCAP_S390_GS = 16384 - HWCAP_S390_VXRS_EXT2 = 32768 - HWCAP_S390_VXRS_PDE = 65536 - HWCAP_S390_SORT = 131072 - HWCAP_S390_DFLT = 262144 + HWCAP_S390_ESAN3 = 1 + HWCAP_S390_ZARCH = 2 + HWCAP_S390_STFLE = 4 + HWCAP_S390_MSA = 8 + HWCAP_S390_LDISP = 16 + HWCAP_S390_EIMM = 32 + HWCAP_S390_DFP = 64 + HWCAP_S390_HPAGE = 128 + HWCAP_S390_ETF3EH = 256 + HWCAP_S390_HIGH_GPRS = 512 + HWCAP_S390_TE = 1024 + HWCAP_S390_VX = 2048 + HWCAP_S390_VXD = 4096 + HWCAP_S390_VXE = 8192 + HWCAP_S390_GS = 16384 + HWCAP_S390_VXRS_EXT2 = 32768 + HWCAP_S390_VXRS_PDE = 65536 + HWCAP_S390_SORT = 131072 + HWCAP_S390_DFLT = 262144 ) var flagNames_s390x = map[uint64]string{ - HWCAP_S390_ESAN3: "ESAN3", - HWCAP_S390_ZARCH: "ZARCH", - HWCAP_S390_STFLE: "STFLE", - HWCAP_S390_MSA: "MSA", - HWCAP_S390_LDISP: "LDISP", - HWCAP_S390_EIMM: "EIMM", - HWCAP_S390_DFP: "DFP", - HWCAP_S390_HPAGE: "EDAT", - HWCAP_S390_ETF3EH: "ETF3EH", - HWCAP_S390_HIGH_GPRS: "HIGHGPRS", - HWCAP_S390_TE: "TE", - HWCAP_S390_VX: "VX", - HWCAP_S390_VXD: "VXD", - HWCAP_S390_VXE: "VXE", - HWCAP_S390_GS: "GS", - HWCAP_S390_VXRS_EXT2: "VXE2", - HWCAP_S390_VXRS_PDE: "VXP", - HWCAP_S390_SORT: "SORT", - HWCAP_S390_DFLT: "DFLT", + HWCAP_S390_ESAN3: "ESAN3", + HWCAP_S390_ZARCH: "ZARCH", + HWCAP_S390_STFLE: "STFLE", + HWCAP_S390_MSA: "MSA", + HWCAP_S390_LDISP: "LDISP", + HWCAP_S390_EIMM: "EIMM", + HWCAP_S390_DFP: "DFP", + HWCAP_S390_HPAGE: "EDAT", + HWCAP_S390_ETF3EH: "ETF3EH", + HWCAP_S390_HIGH_GPRS: "HIGHGPRS", + HWCAP_S390_TE: "TE", + HWCAP_S390_VX: "VX", + HWCAP_S390_VXD: "VXD", + HWCAP_S390_VXE: "VXE", + HWCAP_S390_GS: "GS", + HWCAP_S390_VXRS_EXT2: "VXE2", + HWCAP_S390_VXRS_PDE: "VXP", + HWCAP_S390_SORT: "SORT", + HWCAP_S390_DFLT: "DFLT", } func getCpuidFlags() []string {