From 2e5b4f13dd6040a0ab2383b53eb64b06a7821e73 Mon Sep 17 00:00:00 2001 From: Simone Basso Date: Fri, 20 Aug 2021 14:00:06 +0200 Subject: [PATCH] fix(internal/platform): support freebsd (#445) See https://github.com/ooni/probe/issues/1696 --- internal/platform/platform.go | 6 ++++-- internal/platform/platform_test.go | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/internal/platform/platform.go b/internal/platform/platform.go index a4b28ee..70519ae 100644 --- a/internal/platform/platform.go +++ b/internal/platform/platform.go @@ -16,7 +16,9 @@ import "runtime" // // 4. "windows" // -// 5. "unknown" +// 5. "freebsd" +// +// 6. "unknown" // // You should use this name to annotate measurements. func Name() string { @@ -30,7 +32,7 @@ func name(goos string) string { // // See https://golang.org/doc/go1.16#darwin switch goos { - case "android", "linux", "windows", "ios": + case "android", "freebsd", "ios", "linux", "windows": return goos case "darwin": return "macos" diff --git a/internal/platform/platform_test.go b/internal/platform/platform_test.go index 674849d..8772e4e 100644 --- a/internal/platform/platform_test.go +++ b/internal/platform/platform_test.go @@ -8,7 +8,7 @@ import ( func TestGood(t *testing.T) { var expected bool switch Name() { - case "android", "ios", "linux", "macos", "windows": + case "android", "freebsd", "ios", "linux", "macos", "windows": expected = true } if !expected { @@ -23,6 +23,9 @@ func TestName(t *testing.T) { }{{ expected: "android", goos: "android", + }, { + expected: "freebsd", + goos: "freebsd", }, { expected: "ios", goos: "ios",