Skip to content

Commit 60f4fc7

Browse files
committed
add SPDX License, remove old build tag, and replace import
1 parent 324af9e commit 60f4fc7

File tree

231 files changed

+369
-289
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

231 files changed

+369
-289
lines changed

README.md

+13-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55
This is a port of psutil (https://github.com/giampaolo/psutil). The
66
challenge is porting all psutil functions on some architectures.
77

8-
## v3 migration
8+
## migration
9+
10+
### v4 migration
11+
12+
See v4 release note.
13+
14+
### v3 migration
915

1016
From v3.20.10, gopsutil becomes v3 which breaks backwards compatibility.
1117
See [v3Changes.md](_tools/v3migration/v3Changes.md) for more detailed changes.
@@ -15,10 +21,10 @@ See [v3Changes.md](_tools/v3migration/v3Changes.md) for more detailed changes.
1521
gopsutil tag policy is almost same as Semantic Versioning, but
1622
automatically increases like [Ubuntu versioning](https://calver.org/).
1723

18-
For example, v2.17.04 means
24+
For example, v4.24.04 means
1925

20-
- v2: major version
21-
- 17: release year, 2017
26+
- v4: major version
27+
- 24: release year, 2024
2228
- 04: release month
2329

2430
gopsutil aims to keep backwards compatibility until major version change.
@@ -52,7 +58,7 @@ package main
5258
import (
5359
"fmt"
5460

55-
"github.com/shirou/gopsutil/v3/mem"
61+
"github.com/shirou/gopsutil/v4/mem"
5662
// "github.com/shirou/gopsutil/mem" // to use v2
5763
)
5864

@@ -122,11 +128,11 @@ Be very careful that enabling the cache may cause inconsistencies. For example,
122128

123129
## Documentation
124130

125-
See https://pkg.go.dev/github.com/shirou/gopsutil/v3 or https://godocs.io/github.com/shirou/gopsutil/v3
131+
See https://pkg.go.dev/github.com/shirou/gopsutil/v4 or https://godocs.io/github.com/shirou/gopsutil/v4
126132

127133
## Requirements
128134

129-
- go1.16 or above is required.
135+
- go1.20 or above is required.
130136

131137
## More Info
132138

common/env.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
package common
23

34
type EnvKeyType string

cpu/cpu.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
package cpu
23

34
import (
@@ -11,7 +12,7 @@ import (
1112
"sync"
1213
"time"
1314

14-
"github.com/shirou/gopsutil/v3/internal/common"
15+
"github.com/shirou/gopsutil/v4/internal/common"
1516
)
1617

1718
// TimesStat contains the amounts of time the CPU has spent performing different

cpu/cpu_aix.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
//go:build aix
2-
// +build aix
33

44
package cpu
55

cpu/cpu_aix_cgo.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
//go:build aix && cgo
2-
// +build aix,cgo
33

44
package cpu
55

cpu/cpu_aix_nocgo.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
//go:build aix && !cgo
2-
// +build aix,!cgo
33

44
package cpu
55

@@ -8,7 +8,7 @@ import (
88
"strconv"
99
"strings"
1010

11-
"github.com/shirou/gopsutil/v3/internal/common"
11+
"github.com/shirou/gopsutil/v4/internal/common"
1212
)
1313

1414
func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) {

cpu/cpu_darwin.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
//go:build darwin
2-
// +build darwin
33

44
package cpu
55

cpu/cpu_darwin_cgo.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
//go:build darwin && cgo
2-
// +build darwin,cgo
33

44
package cpu
55

cpu/cpu_darwin_nocgo.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
//go:build darwin && !cgo
2-
// +build darwin,!cgo
33

44
package cpu
55

6-
import "github.com/shirou/gopsutil/v3/internal/common"
6+
import "github.com/shirou/gopsutil/v4/internal/common"
77

88
func perCPUTimes() ([]TimesStat, error) {
99
return []TimesStat{}, common.ErrNotImplementedError

cpu/cpu_darwin_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
//go:build darwin
2-
// +build darwin
33

44
package cpu
55

cpu/cpu_dragonfly.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
package cpu
23

34
import (
@@ -10,7 +11,7 @@ import (
1011
"strings"
1112
"unsafe"
1213

13-
"github.com/shirou/gopsutil/v3/internal/common"
14+
"github.com/shirou/gopsutil/v4/internal/common"
1415
"github.com/tklauser/go-sysconf"
1516
"golang.org/x/sys/unix"
1617
)

cpu/cpu_dragonfly_amd64.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
package cpu
23

34
type cpuTimes struct {

cpu/cpu_fallback.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
//go:build !darwin && !linux && !freebsd && !openbsd && !netbsd && !solaris && !windows && !dragonfly && !plan9 && !aix
2-
// +build !darwin,!linux,!freebsd,!openbsd,!netbsd,!solaris,!windows,!dragonfly,!plan9,!aix
33

44
package cpu
55

66
import (
77
"context"
88
"runtime"
99

10-
"github.com/shirou/gopsutil/v3/internal/common"
10+
"github.com/shirou/gopsutil/v4/internal/common"
1111
)
1212

1313
func Times(percpu bool) ([]TimesStat, error) {

cpu/cpu_freebsd.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
package cpu
23

34
import (
@@ -10,7 +11,7 @@ import (
1011
"strings"
1112
"unsafe"
1213

13-
"github.com/shirou/gopsutil/v3/internal/common"
14+
"github.com/shirou/gopsutil/v4/internal/common"
1415
"github.com/tklauser/go-sysconf"
1516
"golang.org/x/sys/unix"
1617
)

cpu/cpu_freebsd_386.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
package cpu
23

34
type cpuTimes struct {

cpu/cpu_freebsd_amd64.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
package cpu
23

34
type cpuTimes struct {

cpu/cpu_freebsd_arm.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
package cpu
23

34
type cpuTimes struct {

cpu/cpu_freebsd_arm64.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
package cpu
23

34
type cpuTimes struct {

cpu/cpu_freebsd_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
package cpu
23

34
import (
45
"path/filepath"
56
"runtime"
67
"testing"
78

8-
"github.com/shirou/gopsutil/v3/internal/common"
9+
"github.com/shirou/gopsutil/v4/internal/common"
910
)
1011

1112
func TestParseDmesgBoot(t *testing.T) {

cpu/cpu_linux.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
//go:build linux
2-
// +build linux
33

44
package cpu
55

@@ -13,7 +13,7 @@ import (
1313

1414
"github.com/tklauser/go-sysconf"
1515

16-
"github.com/shirou/gopsutil/v3/internal/common"
16+
"github.com/shirou/gopsutil/v4/internal/common"
1717
)
1818

1919
var ClocksPerSec = float64(100)

cpu/cpu_linux_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
package cpu
23

34
import (

cpu/cpu_netbsd.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
//go:build netbsd
2-
// +build netbsd
33

44
package cpu
55

@@ -9,7 +9,7 @@ import (
99
"runtime"
1010
"unsafe"
1111

12-
"github.com/shirou/gopsutil/v3/internal/common"
12+
"github.com/shirou/gopsutil/v4/internal/common"
1313
"github.com/tklauser/go-sysconf"
1414
"golang.org/x/sys/unix"
1515
)

cpu/cpu_netbsd_amd64.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
package cpu
23

34
type cpuTimes struct {

cpu/cpu_netbsd_arm64.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
package cpu
23

34
type cpuTimes struct {

cpu/cpu_openbsd.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
//go:build openbsd
2-
// +build openbsd
33

44
package cpu
55

@@ -9,7 +9,7 @@ import (
99
"runtime"
1010
"unsafe"
1111

12-
"github.com/shirou/gopsutil/v3/internal/common"
12+
"github.com/shirou/gopsutil/v4/internal/common"
1313
"github.com/tklauser/go-sysconf"
1414
"golang.org/x/sys/unix"
1515
)

cpu/cpu_openbsd_386.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
package cpu
23

34
type cpuTimes struct {

cpu/cpu_openbsd_amd64.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
package cpu
23

34
type cpuTimes struct {

cpu/cpu_openbsd_arm.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
package cpu
23

34
type cpuTimes struct {

cpu/cpu_openbsd_arm64.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
package cpu
23

34
type cpuTimes struct {

cpu/cpu_openbsd_riscv64.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
package cpu
23

34
type cpuTimes struct {

cpu/cpu_plan9.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
//go:build plan9
2-
// +build plan9
33

44
package cpu
55

@@ -9,7 +9,7 @@ import (
99
"runtime"
1010

1111
stats "github.com/lufia/plan9stats"
12-
"github.com/shirou/gopsutil/v3/internal/common"
12+
"github.com/shirou/gopsutil/v4/internal/common"
1313
)
1414

1515
func Times(percpu bool) ([]TimesStat, error) {

cpu/cpu_plan9_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
//go:build plan9
2-
// +build plan9
33

44
package cpu
55

cpu/cpu_solaris.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
package cpu
23

34
import (

cpu/cpu_solaris_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
package cpu
23

34
import (

cpu/cpu_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
package cpu
23

34
import (
@@ -10,7 +11,7 @@ import (
1011

1112
"github.com/stretchr/testify/assert"
1213

13-
"github.com/shirou/gopsutil/v3/internal/common"
14+
"github.com/shirou/gopsutil/v4/internal/common"
1415
)
1516

1617
func skipIfNotImplementedErr(t *testing.T, err error) {

cpu/cpu_windows.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
//go:build windows
2-
// +build windows
33

44
package cpu
55

@@ -8,7 +8,7 @@ import (
88
"fmt"
99
"unsafe"
1010

11-
"github.com/shirou/gopsutil/v3/internal/common"
11+
"github.com/shirou/gopsutil/v4/internal/common"
1212
"github.com/yusufpapurcu/wmi"
1313
"golang.org/x/sys/windows"
1414
)

disk/disk.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
package disk
23

34
import (
45
"context"
56
"encoding/json"
67

7-
"github.com/shirou/gopsutil/v3/internal/common"
8+
"github.com/shirou/gopsutil/v4/internal/common"
89
)
910

1011
var invoke common.Invoker = common.Invoke{}

disk/disk_aix.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
//go:build aix
2-
// +build aix
33

44
package disk
55

66
import (
77
"context"
88

9-
"github.com/shirou/gopsutil/v3/internal/common"
9+
"github.com/shirou/gopsutil/v4/internal/common"
1010
)
1111

1212
func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOCountersStat, error) {

0 commit comments

Comments
 (0)