From 2de796119631505b09b31b62ac19397733e7cfbe Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Thu, 12 Dec 2024 12:06:59 +0000 Subject: [PATCH] go-fmt Signed-off-by: Kristoffer Dalby --- Makefile | 5 ++++- hscontrol/auth.go | 1 - hscontrol/db/db_test.go | 1 - hscontrol/oidc.go | 4 ++-- hscontrol/util/dns.go | 1 - integration/auth_oidc_test.go | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 96aff1fd96..fb22e7bb52 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,10 @@ fmt-prettier: prettier --write '**/**.{ts,js,md,yaml,yml,sass,css,scss,html}' fmt-go: - golines --max-len=88 --base-formatter=gofumpt -w $(GO_SOURCES) + # TODO(kradalby): Reeval if we want to use 88 in the future. + # golines --max-len=88 --base-formatter=gofumpt -w $(GO_SOURCES) + gofumpt -l -w . + golangci-lint run --fix fmt-proto: clang-format -i $(PROTO_SOURCES) diff --git a/hscontrol/auth.go b/hscontrol/auth.go index 2b23aad3d7..b4923ccb5c 100644 --- a/hscontrol/auth.go +++ b/hscontrol/auth.go @@ -390,7 +390,6 @@ func (h *Headscale) handleAuthKey( http.Error(writer, "Internal server error", http.StatusInternalServerError) return } - } err = h.db.Write(func(tx *gorm.DB) error { diff --git a/hscontrol/db/db_test.go b/hscontrol/db/db_test.go index bafe1e1b76..95c82160b7 100644 --- a/hscontrol/db/db_test.go +++ b/hscontrol/db/db_test.go @@ -373,6 +373,5 @@ func TestConstraints(t *testing.T) { tt.run(t, db.DB.Debug()) }) - } } diff --git a/hscontrol/oidc.go b/hscontrol/oidc.go index 1db1ec079f..14191d23d0 100644 --- a/hscontrol/oidc.go +++ b/hscontrol/oidc.go @@ -447,7 +447,7 @@ func (a *AuthProviderOIDC) createOrUpdateUserFromClaim( // This check is for legacy, if the user cannot be found by the OIDC identifier // look it up by username. This should only be needed once. - // This branch will presist for a number of versions after the OIDC migration and + // This branch will persist for a number of versions after the OIDC migration and // then be removed following a deprecation. // TODO(kradalby): Remove when strip_email_domain and migration is removed // after #2170 is cleaned up. @@ -536,7 +536,7 @@ func renderOIDCCallbackTemplate( // TODO(kradalby): Reintroduce when strip_email_domain is removed // after #2170 is cleaned up -// DEPRECATED: DO NOT USE +// DEPRECATED: DO NOT USE. func getUserName( claims *types.OIDCClaims, stripEmaildomain bool, diff --git a/hscontrol/util/dns.go b/hscontrol/util/dns.go index bf43eb507a..c6861c9e31 100644 --- a/hscontrol/util/dns.go +++ b/hscontrol/util/dns.go @@ -189,7 +189,6 @@ func GenerateIPv6DNSRootDomain(ipPrefix netip.Prefix) []dnsname.FQDN { // NormalizeToFQDNRules will replace forbidden chars in user // it can also return an error if the user doesn't respect RFC 952 and 1123. func NormalizeToFQDNRules(name string, stripEmailDomain bool) (string, error) { - name = strings.ToLower(name) name = strings.ReplaceAll(name, "'", "") atIdx := strings.Index(name, "@") diff --git a/integration/auth_oidc_test.go b/integration/auth_oidc_test.go index 54aa05fbee..52d28054dc 100644 --- a/integration/auth_oidc_test.go +++ b/integration/auth_oidc_test.go @@ -154,7 +154,7 @@ func TestOIDCAuthenticationPingAll(t *testing.T) { } sort.Slice(listUsers, func(i, j int) bool { - return listUsers[i].Id < listUsers[j].Id + return listUsers[i].GetId() < listUsers[j].GetId() }) if diff := cmp.Diff(want, listUsers, cmpopts.IgnoreUnexported(v1.User{}), cmpopts.IgnoreFields(v1.User{}, "CreatedAt")); diff != "" { @@ -514,7 +514,7 @@ func TestOIDC024UserCreation(t *testing.T) { assertNoErr(t, err) sort.Slice(listUsers, func(i, j int) bool { - return listUsers[i].Id < listUsers[j].Id + return listUsers[i].GetId() < listUsers[j].GetId() }) if diff := cmp.Diff(want, listUsers, cmpopts.IgnoreUnexported(v1.User{}), cmpopts.IgnoreFields(v1.User{}, "CreatedAt")); diff != "" {