Skip to content

Commit

Permalink
Update Go
Browse files Browse the repository at this point in the history
* Update build to latest two Go releases.
* Bump module requirements.
* Fixup go fmt.

Signed-off-by: SuperQ <superq@gmail.com>
  • Loading branch information
SuperQ committed Oct 11, 2022
1 parent b3d77ec commit 3d4fb4d
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 42 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Expand Up @@ -4,7 +4,7 @@ version: 2.1
jobs:
lint:
docker:
- image: cimg/go:1.18
- image: cimg/go:1.19
steps:
- checkout
- run: make check_license
Expand Down Expand Up @@ -54,15 +54,15 @@ workflows:
matrix:
parameters:
go_version:
- "1.17"
- "1.18"
- "1.19"
- test:
name: test-windows
os: windows
run_test: false
matrix:
parameters:
go_version:
- "1.17"
- "1.18"
- "1.19"
- codespell
51 changes: 25 additions & 26 deletions doc.go
Expand Up @@ -16,30 +16,29 @@
//
// Example:
//
// package main
//
// import (
// "fmt"
// "log"
//
// "github.com/prometheus/procfs"
// )
//
// func main() {
// p, err := procfs.Self()
// if err != nil {
// log.Fatalf("could not get process: %s", err)
// }
//
// stat, err := p.Stat()
// if err != nil {
// log.Fatalf("could not get process stat: %s", err)
// }
//
// fmt.Printf("command: %s\n", stat.Comm)
// fmt.Printf("cpu time: %fs\n", stat.CPUTime())
// fmt.Printf("vsize: %dB\n", stat.VirtualMemory())
// fmt.Printf("rss: %dB\n", stat.ResidentMemory())
// }
//
// package main
//
// import (
// "fmt"
// "log"
//
// "github.com/prometheus/procfs"
// )
//
// func main() {
// p, err := procfs.Self()
// if err != nil {
// log.Fatalf("could not get process: %s", err)
// }
//
// stat, err := p.Stat()
// if err != nil {
// log.Fatalf("could not get process stat: %s", err)
// }
//
// fmt.Printf("command: %s\n", stat.Comm)
// fmt.Printf("cpu time: %fs\n", stat.CPUTime())
// fmt.Printf("vsize: %dB\n", stat.VirtualMemory())
// fmt.Printf("rss: %dB\n", stat.ResidentMemory())
// }
package procfs
6 changes: 3 additions & 3 deletions go.mod
@@ -1,9 +1,9 @@
module github.com/prometheus/procfs

go 1.17
go 1.18

require (
github.com/google/go-cmp v0.5.9
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a
golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0
golang.org/x/sys v0.0.0-20221010170243-090e33056c14
)
8 changes: 4 additions & 4 deletions go.sum
@@ -1,6 +1,6 @@
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f h1:Ax0t5p6N38Ga0dThY21weqDEyz2oklo4IvDkpigvkD8=
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0 h1:cu5kTvlzcw1Q5S9f5ip1/cpiB4nXvw1XYzFPGgzLUOY=
golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20221010170243-090e33056c14 h1:k5II8e6QD8mITdi+okbbmR/cIyEbeXLBhy5Ha4nevyc=
golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
3 changes: 2 additions & 1 deletion mountstats.go
Expand Up @@ -284,7 +284,8 @@ func parseMountStats(r io.Reader) ([]*Mount, error) {
}

// parseMount parses an entry in /proc/[pid]/mountstats in the format:
// device [device] mounted on [mount] with fstype [type]
//
// device [device] mounted on [mount] with fstype [type]
func parseMount(ss []string) (*Mount, error) {
if len(ss) < deviceEntryLen {
return nil, fmt.Errorf("invalid device entry: %v", ss)
Expand Down
1 change: 1 addition & 0 deletions nfs/nfs.go
Expand Up @@ -204,6 +204,7 @@ type ServerV4Stats struct {
// - v4.0 https://tools.ietf.org/html/rfc3010 (38 operations)
// - v4.1 https://tools.ietf.org/html/rfc5661 (58 operations)
// - v4.2 https://tools.ietf.org/html/draft-ietf-nfsv4-minorversion2-41 (71 operations)
//
//nolint:godot
type V4Ops struct {
//Values uint64 // Variable depending on v4.x sub-version. TODO: Will this always at least include the fields in this struct?
Expand Down
8 changes: 4 additions & 4 deletions proc_cgroups_test.go
Expand Up @@ -26,8 +26,8 @@ func TestParseCgroupSummaryString(t *testing.T) {
CgroupSummary *CgroupSummary
}{
{
name: "cpuset simple line",
s: "cpuset 7 148 1",
name: "cpuset simple line",
s: "cpuset 7 148 1",
shouldErr: false,
CgroupSummary: &CgroupSummary{
SubsysName: "cpuset",
Expand All @@ -37,8 +37,8 @@ func TestParseCgroupSummaryString(t *testing.T) {
},
},
{
name: "memory cgroup number mis format",
s: "memory 9 ## 1",
name: "memory cgroup number mis format",
s: "memory 9 ## 1",
shouldErr: true,
CgroupSummary: nil,
},
Expand Down
4 changes: 3 additions & 1 deletion vm.go
Expand Up @@ -26,7 +26,9 @@ import (
)

// The VM interface is described at
// https://www.kernel.org/doc/Documentation/sysctl/vm.txt
//
// https://www.kernel.org/doc/Documentation/sysctl/vm.txt
//
// Each setting is exposed as a single file.
// Each file contains one line with a single numerical value, except lowmem_reserve_ratio which holds an array
// and numa_zonelist_order (deprecated) which is a string.
Expand Down

0 comments on commit 3d4fb4d

Please sign in to comment.