diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2024-02-07 13:50:00 +0100 |
|---|---|---|
| committer | Jeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com> | 2024-02-19 14:15:07 +0100 |
| commit | 9cbe11f260ea9bede2ddc25c689e2761ae14039f (patch) | |
| tree | 4db30293a1b3db20565c912a49e5ae685d63ed8e /types | |
| parent | ce52709e35bc92d12f3a94f6d0b521ef6ab69859 (diff) | |
Format: Run gofumpt
Diffstat (limited to 'types')
| -rw-r--r-- | types/cookie/cookie.go | 4 | ||||
| -rw-r--r-- | types/server/server_test.go | 25 |
2 files changed, 14 insertions, 15 deletions
diff --git a/types/cookie/cookie.go b/types/cookie/cookie.go index 1582a9c..1714682 100644 --- a/types/cookie/cookie.go +++ b/types/cookie/cookie.go @@ -5,10 +5,10 @@ package cookie import ( - "fmt" "context" - "errors" "encoding/json" + "errors" + "fmt" "runtime/cgo" ) diff --git a/types/server/server_test.go b/types/server/server_test.go index 06a6851..f3c396d 100644 --- a/types/server/server_test.go +++ b/types/server/server_test.go @@ -13,62 +13,62 @@ func errorString(err error) string { } func TestServerUnmarshal(t *testing.T) { - cases := []struct{ - want Type + cases := []struct { + want Type wantErr string payload string }{ { - want: TypeUnknown, + want: TypeUnknown, wantErr: "invalid server type: a", payload: `{"value": "a"}`, }, { - want: TypeInstituteAccess, + want: TypeInstituteAccess, wantErr: "", payload: `{"value": "institute_access"}`, }, { - want: TypeCustom, + want: TypeCustom, wantErr: "", payload: `{"value": "custom_server"}`, }, { - want: TypeSecureInternet, + want: TypeSecureInternet, wantErr: "", payload: `{"value": "secure_internet"}`, }, { - want: TypeUnknown, + want: TypeUnknown, wantErr: "", payload: `{"value": 0}`, }, { - want: TypeInstituteAccess, + want: TypeInstituteAccess, wantErr: "", payload: `{"value": 1}`, }, { - want: TypeSecureInternet, + want: TypeSecureInternet, wantErr: "", payload: `{"value": 2}`, }, { - want: TypeCustom, + want: TypeCustom, wantErr: "", payload: `{"value": 3}`, }, // Values that are outside the range will be error checked too // This is thus even more strict than a regular type unmarshal/marshal { - want: TypeUnknown, + want: TypeUnknown, wantErr: "invalid server type: 25", payload: `{"value": 25}`, }, } for _, c := range cases { - var got struct{ + var got struct { Value Type `json:"value"` } err := json.Unmarshal([]byte(c.payload), &got) @@ -79,5 +79,4 @@ func TestServerUnmarshal(t *testing.T) { t.Fatalf("server unmarshal value is not equal to want, got: %v, want: %v", got.Value, c.want) } } - } |
