cleanup(platform): we don't need CGO anymore (#355)

* cleanup(platform): we don't need CGO anymore

Since go1.16, we have the `ios` port. So we can easily
disambiguate between ios and darwin.

This means we don't need to rely on CGO to correctly guess
whether we are on ios or darwin anymore.

So, now miniooni does not depend on a C compiler even
when you are not cross compiling.

* Update internal/platform/platform.go
This commit is contained in:
Simone Basso 2021-06-04 11:46:06 +02:00 committed by GitHub
commit 4764d7f378
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 77 deletions

View file

@ -16,51 +16,32 @@ func TestGood(t *testing.T) {
}
}
func TestPuregoname(t *testing.T) {
func TestName(t *testing.T) {
var runtimevariables = []struct {
expected string
goarch string
goos string
}{{
expected: "android",
goarch: "*",
goos: "android",
}, {
expected: "ios",
goarch: "arm64",
goos: "darwin",
}, {
expected: "ios",
goarch: "arm",
goos: "darwin",
goos: "ios",
}, {
expected: "linux",
goarch: "*",
goos: "linux",
}, {
expected: "macos",
goarch: "amd64",
goos: "darwin",
}, {
expected: "macos",
goarch: "386",
goos: "darwin",
}, {
expected: "unknown",
goarch: "*",
goos: "solaris",
}, {
expected: "unknown",
goarch: "mips",
goos: "darwin",
}, {
expected: "windows",
goarch: "*",
goos: "windows",
}}
for _, v := range runtimevariables {
t.Run(fmt.Sprintf("with %s/%s", v.goos, v.goarch), func(t *testing.T) {
if puregoname(v.goos, v.goarch) != v.expected {
t.Run(fmt.Sprintf("with %s", v.goos), func(t *testing.T) {
if name(v.goos) != v.expected {
t.Fatal("unexpected results")
}
})