Skip to content

Commit

Permalink
Fix build tags on AIX provider (#116)
Browse files Browse the repository at this point in the history
* Add build tags to aix provider

* Add cross-compile checks to CI

* Update golang.org/x/sys

This brings in an updated version that supports windows/arm64.

* Document GOOS / GOARCH / CGO

* Bump Go versions

Fixes #106
  • Loading branch information
andrewkroh authored Jun 4, 2022
1 parent 69da652 commit 3b62836
Show file tree
Hide file tree
Showing 15 changed files with 102 additions and 31 deletions.
6 changes: 3 additions & 3 deletions .ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pipeline {
axes {
axis {
name 'GO_VERSION'
values '1.17.10', '1.18.2'
values '1.17.11', '1.18.3'
}
axis {
name 'PLATFORM'
Expand All @@ -48,7 +48,7 @@ pipeline {
exclude {
axis {
name 'GO_VERSION'
values '1.17.10'
values '1.17.11'
}
axis {
name 'PLATFORM'
Expand All @@ -58,7 +58,7 @@ pipeline {
exclude {
axis {
name 'GO_VERSION'
values '1.18.2'
values '1.18.3'
}
axis {
name 'PLATFORM'
Expand Down
25 changes: 25 additions & 0 deletions .ci/scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,31 @@ go-licenser -d
go run .ci/scripts/check_format.go
go run .ci/scripts/check_lint.go

# Cross-compile checks (only execute on Linux to avoid running this multiple times).
if [[ $(go env GOOS) == "linux" ]]; then
# Test that there are no compilation issues when not using CGO. This does
# not imply that all of these targets are supported without CGO. It's only
# a sanity check for build tag issues.
CGO_ENABLED=0 GOOS=aix GOARCH=ppc64 go build ./...
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build ./...
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build ./...
CGO_ENABLED=0 GOOS=linux GOARCH=386 go build ./...
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ./...
CGO_ENABLED=0 GOOS=linux GOARCH=arm go build ./...
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build ./...
CGO_ENABLED=0 GOOS=linux GOARCH=mips go build ./...
CGO_ENABLED=0 GOOS=linux GOARCH=mips64 go build ./...
CGO_ENABLED=0 GOOS=linux GOARCH=mips64le go build ./...
CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build ./...
CGO_ENABLED=0 GOOS=linux GOARCH=ppc64 go build ./...
CGO_ENABLED=0 GOOS=linux GOARCH=ppc64le go build ./...
CGO_ENABLED=0 GOOS=linux GOARCH=riscv64 go build ./...
CGO_ENABLED=0 GOOS=linux GOARCH=s390x go build ./...
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build ./...
CGO_ENABLED=0 GOOS=windows GOARCH=arm go build ./...
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build ./...
fi

# Run the tests
set +e
export OUT_FILE="build/test-report.out"
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Fix handling of environment variables without values on macOS. [#94](https://github.com/elastic/go-sysinfo/pull/94)
- Fix build tags on AIX provider such that CGO is required. [#106](https://github.com/elastic/go-sysinfo/issues/106)

## [1.7.1] - 2021-10-11

Expand Down
68 changes: 46 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[![Build Status](https://beats-ci.elastic.co/job/Library/job/go-sysinfo-mbp/job/main/badge/icon)](https://beats-ci.elastic.co/job/Library/job/go-sysinfo-mbp/job/main/)
[![Go Documentation](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)][godocs]

[travis]: http://travis-ci.org/elastic/go-sysinfo
[godocs]: http://godoc.org/github.com/elastic/go-sysinfo

go-sysinfo is a library for collecting system information. This includes
Expand Down Expand Up @@ -31,24 +30,49 @@ if handleCounter, ok := process.(types.OpenHandleCounter); ok {
These tables show what methods are implemented as well as the extra interfaces
that are implemented.

| `Host` Features | Darwin | Linux | Windows | AIX/ppc64 |
|------------------|--------|-------|---------|-----------|
| `Info()` | x | x | x | x |
| `Memory()` | x | x | x | x |
| `CPUTimer` | x | x | x | x |
| `VMStat` | | x | | |
| `NetworkCounters`| | x | | |

| `Process` Features | Darwin | Linux | Windows | AIX/ppc64 |
|------------------------|--------|-------|---------|-----------|
| `Info()` | x | x | x | x |
| `Memory()` | x | x | x | x |
| `User()` | x | x | x | x |
| `Parent()` | x | x | x | x |
| `CPUTimer` | x | x | x | x |
| `Environment` | x | x | | x |
| `OpenHandleEnumerator` | | x | | |
| `OpenHandleCounter` | | x | | |
| `Seccomp` | | x | | |
| `Capabilities` | | x | | |
| `NetworkCounters` | | x | | |
| `Host` Features | Darwin | Linux | Windows | AIX |
|------------------|--------|-------|---------|-----|
| `Info()` | x | x | x | x |
| `Memory()` | x | x | x | x |
| `CPUTimer` | x | x | x | x |
| `VMStat` | | x | | |
| `NetworkCounters`| | x | | |

| `Process` Features | Darwin | Linux | Windows | AIX |
|------------------------|--------|-------|---------|-----|
| `Info()` | x | x | x | x |
| `Memory()` | x | x | x | x |
| `User()` | x | x | x | x |
| `Parent()` | x | x | x | x |
| `CPUTimer` | x | x | x | x |
| `Environment` | x | x | | x |
| `OpenHandleEnumerator` | | x | | |
| `OpenHandleCounter` | | x | | |
| `Seccomp` | | x | | |
| `Capabilities` | | x | | |
| `NetworkCounters` | | x | | |

### GOOS / GOARCH Pairs

This table lists the OS and architectures for which a "provider" is implemented.

| GOOS / GOARCH | Requires CGO | Tested |
|----------------|--------------|--------|
| aix/ppc64 | x | |
| darwin/amd64 | x | x |
| darwin/arm64 | x | x |
| linux/386 | | |
| linux/amd64 | | x |
| linux/arm | | |
| linux/arm64 | | |
| linux/mips | | |
| linux/mips64 | | |
| linux/mips64le | | |
| linux/mipsle | | |
| linux/ppc64 | | |
| linux/ppc64le | | |
| linux/riscv64 | | |
| linux/s390x | | |
| windows/amd64 | | x |
| windows/arm64 | | |
| windows/arm | | |
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/pkg/errors v0.8.1
github.com/prometheus/procfs v0.0.0-20190425082905-87a4384529e0
github.com/stretchr/testify v1.3.0
golang.org/x/sys v0.0.0-20191025021431-6c3a3bfe00ae
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a
howett.net/plist v0.0.0-20181124034731-591f970eefbb
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20191025021431-6c3a3bfe00ae h1:QoJmnb9uyPCrH8GIg9uRLn4Ta45yhcQtpymCd0AavO8=
golang.org/x/sys v0.0.0-20191025021431-6c3a3bfe00ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
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=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
// specific language governing permissions and limitations
// under the License.

//go:build aix && ppc64
// +build aix,ppc64

package aix

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
// specific language governing permissions and limitations
// under the License.

//go:build aix
// +build aix
//go:build aix && ppc64
// +build aix,ppc64

package aix

Expand Down
2 changes: 1 addition & 1 deletion providers/aix/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
// under the License.

// Package aix implements the HostProvider and ProcessProvider interfaces
// for providing information about MacOS.
// for providing information about IBM AIX on ppc64.
package aix
3 changes: 3 additions & 0 deletions providers/aix/host_aix.go → providers/aix/host_aix_ppc64.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
// specific language governing permissions and limitations
// under the License.

//go:build aix && ppc64 && cgo
// +build aix,ppc64,cgo

package aix

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
// specific language governing permissions and limitations
// under the License.

//go:build aix && ppc64 && cgo
// +build aix,ppc64,cgo

package aix

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
// specific language governing permissions and limitations
// under the License.

//go:build aix && ppc64 && cgo
// +build aix,ppc64,cgo

package aix

/*
Expand Down
3 changes: 3 additions & 0 deletions providers/aix/os_aix.go → providers/aix/os_aix_ppc64.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
// specific language governing permissions and limitations
// under the License.

//go:build aix && ppc64 && cgo
// +build aix,ppc64,cgo

package aix

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
// specific language governing permissions and limitations
// under the License.

//go:build aix && ppc64 && cgo
// +build aix,ppc64,cgo

package aix

/*
Expand Down
3 changes: 3 additions & 0 deletions providers/aix/ztypes_aix_ppc64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3b62836

Please sign in to comment.