Skip to content

Commit

Permalink
Fixup linting (#442)
Browse files Browse the repository at this point in the history
* Fix check license issues.
* Ignore some revive naming issues.
* Update minimum Go versions.
* Update go fmt for newer Go versions
* Update Go CI versions.
* Repac fixtures.
* Use cimg/go.

Signed-off-by: SuperQ <superq@gmail.com>
  • Loading branch information
SuperQ committed Apr 15, 2022
1 parent fba575d commit cdc4512
Show file tree
Hide file tree
Showing 62 changed files with 86 additions and 28 deletions.
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 2.1
jobs:
lint:
docker:
- image: cimg/go:1.16
- image: cimg/go:1.18
steps:
- checkout
- run: make check_license
Expand All @@ -23,7 +23,7 @@ jobs:
type: boolean
default: true
docker:
- image: circleci/golang:<< parameters.go_version >>
- image: cimg/go:<< parameters.go_version >>
environment:
GOOS: "<< parameters.os >>"
steps:
Expand Down Expand Up @@ -54,19 +54,19 @@ workflows:
matrix:
parameters:
go_version:
- "1.13"
- "1.14"
- "1.15"
- "1.16"
- "1.17"
- "1.18"
- test:
name: test-windows
os: windows
run_test: false
matrix:
parameters:
go_version:
- "1.13"
- "1.14"
- "1.15"
- "1.16"
- "1.17"
- "1.18"
- codespell
1 change: 1 addition & 0 deletions cmdline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux
// +build linux

package procfs
Expand Down
1 change: 1 addition & 0 deletions cpuinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux
// +build linux

package procfs
Expand Down
1 change: 1 addition & 0 deletions cpuinfo_armx.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux && (arm || arm64)
// +build linux
// +build arm arm64

Expand Down
1 change: 1 addition & 0 deletions cpuinfo_mipsx.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux && (mips || mipsle || mips64 || mips64le)
// +build linux
// +build mips mipsle mips64 mips64le

Expand Down
4 changes: 2 additions & 2 deletions cpuinfo_others.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build linux
// +build !386,!amd64,!arm,!arm64,!mips,!mips64,!mips64le,!mipsle,!ppc64,!ppc64le,!riscv64,!s390x
//go:build linux && !386 && !amd64 && !arm && !arm64 && !mips && !mips64 && !mips64le && !mipsle && !ppc64 && !ppc64le && !riscv64 && !s390x
// +build linux,!386,!amd64,!arm,!arm64,!mips,!mips64,!mips64le,!mipsle,!ppc64,!ppc64le,!riscv64,!s390x

package procfs

Expand Down
1 change: 1 addition & 0 deletions cpuinfo_ppcx.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux && (ppc64 || ppc64le)
// +build linux
// +build ppc64 ppc64le

Expand Down
1 change: 1 addition & 0 deletions cpuinfo_riscvx.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux && (riscv || riscv64)
// +build linux
// +build riscv riscv64

Expand Down
1 change: 1 addition & 0 deletions cpuinfo_s390x.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux
// +build linux

package procfs
Expand Down
1 change: 1 addition & 0 deletions cpuinfo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux
// +build linux

package procfs
Expand Down
1 change: 1 addition & 0 deletions cpuinfo_x86.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux && (386 || amd64)
// +build linux
// +build 386 amd64

Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module github.com/prometheus/procfs

go 1.13
go 1.15

require (
github.com/google/go-cmp v0.5.4
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c
github.com/google/go-cmp v0.5.7
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad
)
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M=
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
1 change: 1 addition & 0 deletions internal/util/sysreadfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux && !appengine
// +build linux,!appengine

package util
Expand Down
1 change: 1 addition & 0 deletions internal/util/sysreadfile_compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build (linux && appengine) || !linux
// +build linux,appengine !linux

package util
Expand Down
1 change: 1 addition & 0 deletions kernel_random.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !windows
// +build !windows

package procfs
Expand Down
1 change: 1 addition & 0 deletions kernel_random_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !windows
// +build !windows

package procfs
Expand Down
1 change: 1 addition & 0 deletions proc_maps.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris) && !js
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
// +build !js

Expand Down
1 change: 1 addition & 0 deletions proc_maps32_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris) && (386 || arm || mips || mipsle)
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
// +build 386 arm mips mipsle

Expand Down
6 changes: 5 additions & 1 deletion proc_maps64_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris) && !386 && !arm && !mips && !mipsle
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
// +build !386,!arm,!mips,!mipsle
// +build !386
// +build !arm
// +build !mips
// +build !mipsle

package procfs

Expand Down
4 changes: 2 additions & 2 deletions proc_netstat.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type ProcNetstat struct {
IpExt
}

type TcpExt struct {
type TcpExt struct { // nolint:revive
SyncookiesSent float64
SyncookiesRecv float64
SyncookiesFailed float64
Expand Down Expand Up @@ -147,7 +147,7 @@ type TcpExt struct {
TCPWqueueTooBig float64
}

type IpExt struct {
type IpExt struct { // nolint:revive
InNoRoutes float64
InTruncatedPkts float64
InMcastPkts float64
Expand Down
1 change: 1 addition & 0 deletions proc_smaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !windows
// +build !windows

package procfs
Expand Down
1 change: 1 addition & 0 deletions proc_smaps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !windows
// +build !windows

package procfs
Expand Down
8 changes: 4 additions & 4 deletions proc_snmp.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type ProcSnmp struct {
UdpLite
}

type Ip struct {
type Ip struct { // nolint:revive
Forwarding float64
DefaultTTL float64
InReceives float64
Expand Down Expand Up @@ -93,7 +93,7 @@ type IcmpMsg struct {
OutType3 float64
}

type Tcp struct {
type Tcp struct { // nolint:revive
RtoAlgorithm float64
RtoMin float64
RtoMax float64
Expand All @@ -111,7 +111,7 @@ type Tcp struct {
InCsumErrors float64
}

type Udp struct {
type Udp struct { // nolint:revive
InDatagrams float64
NoPorts float64
InErrors float64
Expand All @@ -122,7 +122,7 @@ type Udp struct {
IgnoredMulti float64
}

type UdpLite struct {
type UdpLite struct { // nolint:revive
InDatagrams float64
NoPorts float64
InErrors float64
Expand Down
6 changes: 3 additions & 3 deletions proc_snmp6.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type ProcSnmp6 struct {
UdpLite6
}

type Ip6 struct {
type Ip6 struct { // nolint:revive
InReceives float64
InHdrErrors float64
InTooBigErrors float64
Expand Down Expand Up @@ -117,7 +117,7 @@ type Icmp6 struct {
OutType143 float64
}

type Udp6 struct {
type Udp6 struct { // nolint:revive
InDatagrams float64
NoPorts float64
InErrors float64
Expand All @@ -128,7 +128,7 @@ type Udp6 struct {
IgnoredMulti float64
}

type UdpLite6 struct {
type UdpLite6 struct { // nolint:revive
InDatagrams float64
NoPorts float64
InErrors float64
Expand Down
1 change: 1 addition & 0 deletions sysfs/class_cooling_device.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux
// +build linux

package sysfs
Expand Down
1 change: 1 addition & 0 deletions sysfs/class_cooling_device_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux
// +build linux

package sysfs
Expand Down
1 change: 1 addition & 0 deletions sysfs/class_dmi.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux
// +build linux

package sysfs
Expand Down
1 change: 1 addition & 0 deletions sysfs/class_dmi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux
// +build linux

package sysfs
Expand Down
1 change: 1 addition & 0 deletions sysfs/class_drm.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux
// +build linux

package sysfs
Expand Down
1 change: 1 addition & 0 deletions sysfs/class_drm_amdgpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux
// +build linux

package sysfs
Expand Down
1 change: 1 addition & 0 deletions sysfs/class_drm_amdgpu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux
// +build linux

package sysfs
Expand Down
1 change: 1 addition & 0 deletions sysfs/class_fibrechannel.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux
// +build linux

package sysfs
Expand Down
1 change: 1 addition & 0 deletions sysfs/class_fibrechannel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux
// +build linux

package sysfs
Expand Down
1 change: 1 addition & 0 deletions sysfs/class_infiniband.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux
// +build linux

package sysfs
Expand Down

0 comments on commit cdc4512

Please sign in to comment.