Skip to content
This repository was archived by the owner on Oct 31, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: build

on:
push: {}

env:
GOPATH: /home/runner/work/go

jobs:
test-after-go-11:
runs-on: ubuntu-latest
strategy:
matrix:
go: [
"1.11.13",
"1.12.17",
"1.13.15",
"1.14.15",
"1.15.15",
"1.16.15",
"1.17.7",
"1.18.3",
]
fail-fast: true

name: Go ${{ matrix.go }} test
steps:
- uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- name: Build
run: go build .
- name: Test
run: go test -v ./...
test-before-go-11:
runs-on: ubuntu-latest
strategy:
matrix:
go: [
"1.6.4",
"1.7.6",
"1.8.7",
"1.9.7",
"1.10.8",
]
fail-fast: true

name: Go ${{ matrix.go }} test
steps:
- uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- name: Setup GOPATH
run: mkdir -p $GOPATH/src/github.com/$GITHUB_REPOSITORY
- name: Copy
run: cp -r ./ $GOPATH/src/github.com/$GITHUB_REPOSITORY
- name: Get
run: cd $GOPATH/src/github.com/$GITHUB_REPOSITORY && go get .
- name: Build
run: cd $GOPATH/src/github.com/$GITHUB_REPOSITORY && go build .
- name: Test
run: cd $GOPATH/src/github.com/$GITHUB_REPOSITORY && go test -v ./...
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

15 changes: 0 additions & 15 deletions Gopkg.lock

This file was deleted.

26 changes: 0 additions & 26 deletions Gopkg.toml

This file was deleted.

2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module github.com/mitchellh/gox

go 1.17

require (
github.com/hashicorp/go-version v1.0.0
github.com/mitchellh/iochan v1.0.0
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
github.com/hashicorp/go-version v1.0.0 h1:21MVWPKDphxa7ineQQTrCU5brh7OuVVAzGOCnnCPtE8=
github.com/hashicorp/go-version v1.0.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/mitchellh/iochan v0.0.0-20150529224432-87b45ffd0e95 h1:aHWVygBsLb+Kls/35B3tevL1hvDxZ0UklPA0BmhqTEk=
github.com/mitchellh/iochan v0.0.0-20150529224432-87b45ffd0e95/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
github.com/mitchellh/iochan v1.0.0 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWeY=
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
27 changes: 20 additions & 7 deletions go_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,26 @@ func TestGoVersion(t *testing.T) {
}

acceptable := []string{
"devel", "go1.0", "go1.1", "go1.2", "go1.3",
"go1.4", "go1.4.1", "go1.4.2", "go1.4.3",
"go1.5", "go1.5.1", "go1.5.2", "go1.5.3", "go1.5.4",
"go1.6", "go1.6.1", "go1.6.2", "go1.6.3", "go1.6.4",
"go1.7", "go1.7.1", "go1.7.2", "go1.7.3", "go1.7.4", "go1.7.5", "go1.7.6",
"go1.8", "go1.8.1", "go1.8.2", "go1.8.3", "go1.8.4",
"go1.9", "go1.9.1", "go1.9.2",
"devel",
"go1.0",
"go1.1",
"go1.2",
"go1.3",
"go1.4",
"go1.5",
"go1.6",
"go1.7",
"go1.8",
"go1.9",
"go1.10",
"go1.11",
"go1.12",
"go1.13",
"go1.14",
"go1.15",
"go1.16",
"go1.17",
"go1.18",
}
found := false
for _, expected := range acceptable {
Expand Down
127 changes: 108 additions & 19 deletions platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,36 @@ func (p *Platform) String() string {
return fmt.Sprintf("%s/%s", p.OS, p.Arch)
}

// addDrop appends all of the "add" entries and drops the "drop" entries, ignoring
// the "Default" parameter.
func addDrop(base []Platform, add []Platform, drop []Platform) []Platform {
newPlatforms := make([]Platform, len(base)+len(add))
copy(newPlatforms, base)
copy(newPlatforms[len(base):], add)

// slow, but we only do this during initialization at most once per version
for _, platform := range drop {
found := -1
for i := range newPlatforms {
if newPlatforms[i].Arch == platform.Arch && newPlatforms[i].OS == platform.OS {
found = i
break
}
}
if found < 0 {
panic(fmt.Sprintf("Expected to remove %+v but not found in list %+v", platform, newPlatforms))
}
if found == len(newPlatforms)-1 {
newPlatforms = newPlatforms[:found]
} else if found == 0 {
newPlatforms = newPlatforms[found:]
} else {
newPlatforms = append(newPlatforms[:found], newPlatforms[found+1:]...)
}
}
return newPlatforms
}

var (
Platforms_1_0 = []Platform{
{"darwin", "386", true},
Expand All @@ -40,64 +70,115 @@ var (
{"windows", "amd64", true},
}

Platforms_1_1 = append(Platforms_1_0, []Platform{
Platforms_1_1 = addDrop(Platforms_1_0, []Platform{
{"freebsd", "arm", true},
{"netbsd", "386", true},
{"netbsd", "amd64", true},
{"netbsd", "arm", true},
{"plan9", "386", false},
}...)
}, nil)

Platforms_1_3 = append(Platforms_1_1, []Platform{
Platforms_1_3 = addDrop(Platforms_1_1, []Platform{
{"dragonfly", "386", false},
{"dragonfly", "amd64", false},
{"nacl", "amd64", false},
{"nacl", "amd64p32", false},
{"nacl", "arm", false},
{"solaris", "amd64", false},
}...)
}, nil)

Platforms_1_4 = append(Platforms_1_3, []Platform{
Platforms_1_4 = addDrop(Platforms_1_3, []Platform{
{"android", "arm", false},
{"plan9", "amd64", false},
}...)
}, nil)

Platforms_1_5 = append(Platforms_1_4, []Platform{
Platforms_1_5 = addDrop(Platforms_1_4, []Platform{
{"darwin", "arm", false},
{"darwin", "arm64", false},
{"linux", "arm64", false},
{"linux", "ppc64", false},
{"linux", "ppc64le", false},
}...)
}, nil)

Platforms_1_6 = append(Platforms_1_5, []Platform{
Platforms_1_6 = addDrop(Platforms_1_5, []Platform{
{"android", "386", false},
{"android", "amd64", false},
{"linux", "mips64", false},
{"linux", "mips64le", false},
}...)
{"nacl", "386", false},
{"openbsd", "arm", true},
}, nil)

Platforms_1_7 = append(Platforms_1_5, []Platform{
Platforms_1_7 = addDrop(Platforms_1_5, []Platform{
// While not fully supported s390x is generally useful
{"linux", "s390x", true},
{"plan9", "arm", false},
// Add the 1.6 Platforms, but reflect full support for mips64 and mips64le
{"android", "386", false},
{"android", "amd64", false},
{"linux", "mips64", true},
{"linux", "mips64le", true},
}...)
{"nacl", "386", false},
{"openbsd", "arm", true},
}, nil)

Platforms_1_8 = append(Platforms_1_7, []Platform{
Platforms_1_8 = addDrop(Platforms_1_7, []Platform{
{"linux", "mips", true},
{"linux", "mipsle", true},
}...)
}, nil)

// no new platforms in 1.9
Platforms_1_9 = Platforms_1_8

// no new platforms in 1.10
Platforms_1_10 = Platforms_1_9
// unannounced, but dropped support for android/amd64
Platforms_1_10 = addDrop(Platforms_1_9, nil, []Platform{{"android", "amd64", false}})

Platforms_1_11 = addDrop(Platforms_1_10, []Platform{
{"js", "wasm", true},
}, nil)

Platforms_1_12 = addDrop(Platforms_1_11, []Platform{
{"aix", "ppc64", false},
{"windows", "arm", true},
}, nil)

Platforms_1_13 = addDrop(Platforms_1_12, []Platform{
{"illumos", "amd64", false},
{"netbsd", "arm64", true},
{"openbsd", "arm64", true},
}, nil)

Platforms_1_14 = addDrop(Platforms_1_13, []Platform{
{"freebsd", "arm64", true},
{"linux", "riscv64", true},
}, []Platform{
// drop nacl
{"nacl", "386", false},
{"nacl", "amd64", false},
{"nacl", "arm", false},
})

Platforms_1_15 = addDrop(Platforms_1_14, []Platform{
{"android", "arm64", false},
}, []Platform{
// drop i386 macos
{"darwin", "386", false},
})

Platforms_1_16 = addDrop(Platforms_1_15, []Platform{
{"android", "amd64", false},
{"darwin", "arm64", true},
{"openbsd", "mips64", false},
}, nil)

Platforms_1_17 = addDrop(Platforms_1_16, []Platform{
{"windows", "arm64", true},
}, nil)

// no new platforms in 1.18
Platforms_1_18 = Platforms_1_17

PlatformsLatest = Platforms_1_10
PlatformsLatest = Platforms_1_18
)

// SupportedPlatforms returns the full list of supported platforms for
Expand Down Expand Up @@ -131,7 +212,15 @@ func SupportedPlatforms(v string) []Platform {
{">= 1.7, < 1.8", Platforms_1_7},
{">= 1.8, < 1.9", Platforms_1_8},
{">= 1.9, < 1.10", Platforms_1_9},
{">=1.10, < 1.11", Platforms_1_10},
{">= 1.10, < 1.11", Platforms_1_10},
{">= 1.11, < 1.12", Platforms_1_11},
{">= 1.12, < 1.13", Platforms_1_12},
{">= 1.13, < 1.14", Platforms_1_13},
{">= 1.14, < 1.15", Platforms_1_14},
{">= 1.15, < 1.16", Platforms_1_15},
{">= 1.16, < 1.17", Platforms_1_16},
{">= 1.17, < 1.18", Platforms_1_17},
{">= 1.18, < 1.19", Platforms_1_18},
}

for _, p := range platforms {
Expand All @@ -145,5 +234,5 @@ func SupportedPlatforms(v string) []Platform {
}

// Assume latest
return Platforms_1_9
return PlatformsLatest
}
Loading