diff --git a/go.mod b/go.mod index fee2d21e1..db932e83a 100644 --- a/go.mod +++ b/go.mod @@ -214,7 +214,7 @@ require ( github.com/xo/dburl v0.16.0 // indirect golang.org/x/mod v0.13.0 // indirect golang.org/x/oauth2 v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect + golang.org/x/text v0.13.0 golang.org/x/time v0.3.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 // indirect diff --git a/internal/authtoken/authtoken.go b/internal/authtoken/authtoken.go index fc9fa7cd3..993c8062d 100644 --- a/internal/authtoken/authtoken.go +++ b/internal/authtoken/authtoken.go @@ -207,6 +207,6 @@ type deletedAuthToken struct { } // TableName returns the tablename to override the default gorm table name -func (s *deletedAuthToken) TableName() string { +func (at *deletedAuthToken) TableName() string { return "auth_token_deleted" } diff --git a/internal/authtoken/gorm.go b/internal/authtoken/gorm.go index 061a6ab6f..4d95c415e 100644 --- a/internal/authtoken/gorm.go +++ b/internal/authtoken/gorm.go @@ -15,29 +15,29 @@ const ( ) // TableName returns the table name for the auth token. -func (s *AuthToken) TableName() string { - if s.tableName != "" { - return s.tableName +func (at *AuthToken) TableName() string { + if at.tableName != "" { + return at.tableName } return defaultAuthTokenTableName } // SetTableName sets the table name. If the caller attempts to // set the name to "" the name will be reset to the default name. -func (s *AuthToken) SetTableName(n string) { - s.tableName = n +func (at *AuthToken) SetTableName(n string) { + at.tableName = n } // TableName returns the table name for the authTokenView. -func (s *authTokenView) TableName() string { - if s.tableName != "" { - return s.tableName +func (atv *authTokenView) TableName() string { + if atv.tableName != "" { + return atv.tableName } return defaultAuthTokenViewName } // SetTableName sets the table name. If the caller attempts to // set the name to "" the name will be reset to the default name. -func (s *authTokenView) SetTableName(n string) { - s.tableName = n +func (atv *authTokenView) SetTableName(n string) { + atv.tableName = n } diff --git a/internal/clientcache/cmd/daemon/status.go b/internal/clientcache/cmd/daemon/status.go index bab48fb4e..ed75e32b0 100644 --- a/internal/clientcache/cmd/daemon/status.go +++ b/internal/clientcache/cmd/daemon/status.go @@ -18,6 +18,8 @@ import ( "github.com/hashicorp/boundary/internal/errors" "github.com/mitchellh/cli" "github.com/posener/complete" + "golang.org/x/text/cases" + "golang.org/x/text/language" ) var errDaemonNotRunning = stderr.New("The daemon process is not running.") @@ -205,7 +207,7 @@ func printUsersTable(us []daemon.UserStatus) []string { } maxLength := base.MaxAttributesLength(nonAttributeMap, nil, nil) ret = append(ret, - fmt.Sprintf(" %s:", strings.Title(r.Name)), + fmt.Sprintf(" %s:", cases.Title(language.English).String(r.Name)), base.WrapMap(6, maxLength+6, nonAttributeMap), ) } diff --git a/internal/clientcache/cmd/daemon/stop_nonwindows.go b/internal/clientcache/cmd/daemon/stop_nonwindows.go index 8a4264514..d24ed4e4a 100644 --- a/internal/clientcache/cmd/daemon/stop_nonwindows.go +++ b/internal/clientcache/cmd/daemon/stop_nonwindows.go @@ -17,7 +17,7 @@ import ( ) // stop will send a term signal to the daemon to shut down. -func (s *StopCommand) stop(ctx context.Context) error { +func (c *StopCommand) stop(ctx context.Context) error { switch { case util.IsNil(ctx): return errors.New("Invalid parameter provided to stop: context is missing") diff --git a/internal/clientcache/cmd/daemon/stop_windows.go b/internal/clientcache/cmd/daemon/stop_windows.go index abc97476f..ceab49cb2 100644 --- a/internal/clientcache/cmd/daemon/stop_windows.go +++ b/internal/clientcache/cmd/daemon/stop_windows.go @@ -20,7 +20,7 @@ import ( ) // stop will send a term signal to the daemon to shut down. -func (s *StopCommand) stop(ctx context.Context) error { +func (c *StopCommand) stop(ctx context.Context) error { switch { case util.IsNil(ctx): return errors.New("Invalid parameter provided to stop: context is missing") @@ -40,7 +40,7 @@ func (s *StopCommand) stop(ctx context.Context) error { } else if apiErr != nil { errMsg = apiErr.Message } - s.UI.Warn(fmt.Sprintf("Failed stopping the daemon through the handler: %q, now killing the process", errMsg)) + c.UI.Warn(fmt.Sprintf("Failed stopping the daemon through the handler: %q, now killing the process", errMsg)) default: // there wasn't an error stopping it through the handler. No need to // force kill the process diff --git a/internal/clientcache/internal/client/client_test.go b/internal/clientcache/internal/client/client_test.go index e9a1204a8..842c5faa9 100644 --- a/internal/clientcache/internal/client/client_test.go +++ b/internal/clientcache/internal/client/client_test.go @@ -57,7 +57,7 @@ func TestClient(t *testing.T) { require.NoError(t, err) var assertRequest func(*http.Request) - var writeResp func(http.ResponseWriter) = func(w http.ResponseWriter) { + writeResp := func(w http.ResponseWriter) { w.WriteHeader(http.StatusNoContent) } mux := http.NewServeMux() diff --git a/internal/clientcache/internal/daemon/server.go b/internal/clientcache/internal/daemon/server.go index 56e98106d..a180150e1 100644 --- a/internal/clientcache/internal/daemon/server.go +++ b/internal/clientcache/internal/daemon/server.go @@ -29,6 +29,8 @@ import ( "github.com/hashicorp/boundary/version" "github.com/hashicorp/go-hclog" "github.com/hashicorp/go-secure-stdlib/parseutil" + "golang.org/x/text/cases" + "golang.org/x/text/language" ) const ( @@ -359,7 +361,7 @@ func (s *CacheServer) printInfo(ctx context.Context) { output = append(output, fmt.Sprintf( "%s%s: %s", strings.Repeat(" ", padding-len(k)), - strings.Title(k), + cases.Title(language.English).String(k), s.info[k])) } output = append(output, "") diff --git a/internal/credential/vault/repository_credential_library_test.go b/internal/credential/vault/repository_credential_library_test.go index 36c59b4f7..b57d0d467 100644 --- a/internal/credential/vault/repository_credential_library_test.go +++ b/internal/credential/vault/repository_credential_library_test.go @@ -2253,6 +2253,8 @@ func TestRepository_ListCredentialLibraries_Pagination(t *testing.T) { page4, ttime, err := repo.ListLibraries(ctx, cs.GetPublicId(), credential.WithLimit(2), credential.WithStartPageAfterItem(page3[0])) require.NoError(err) require.Empty(page4) + assert.True(time.Now().Before(ttime.Add(10 * time.Second))) + assert.True(time.Now().After(ttime.Add(-10 * time.Second))) } emptyPage, ttime, err := repo.ListLibraries(ctx, css[2].GetPublicId(), credential.WithLimit(2)) diff --git a/internal/host/static/host_set.go b/internal/host/static/host_set.go index 069146507..2f22f3a33 100644 --- a/internal/host/static/host_set.go +++ b/internal/host/static/host_set.go @@ -98,6 +98,6 @@ type deletedHostSet struct { } // TableName returns the tablename to override the default gorm table name -func (s *deletedHostSet) TableName() string { +func (ds *deletedHostSet) TableName() string { return "static_host_set_deleted" } diff --git a/internal/host/static/immutable_fields_test.go b/internal/host/static/immutable_fields_test.go index 66ab76627..93aa125f2 100644 --- a/internal/host/static/immutable_fields_test.go +++ b/internal/host/static/immutable_fields_test.go @@ -147,8 +147,8 @@ func TestStaticHost_ImmutableFields(t *testing.T) { } } -func (c *Host) testCloneHost() *Host { - cp := proto.Clone(c.Host) +func (h *Host) testCloneHost() *Host { + cp := proto.Clone(h.Host) return &Host{ Host: cp.(*store.Host), } @@ -221,8 +221,8 @@ func TestStaticHostSet_ImmutableFields(t *testing.T) { } } -func (c *HostSet) testCloneHostSet() *HostSet { - cp := proto.Clone(c.HostSet) +func (s *HostSet) testCloneHostSet() *HostSet { + cp := proto.Clone(s.HostSet) return &HostSet{ HostSet: cp.(*store.HostSet), } @@ -290,8 +290,8 @@ func TestStaticHostSetMember_ImmutableFields(t *testing.T) { } } -func (c *HostSetMember) testCloneHostSetMember() *HostSetMember { - cp := proto.Clone(c.HostSetMember) +func (m *HostSetMember) testCloneHostSetMember() *HostSetMember { + cp := proto.Clone(m.HostSetMember) return &HostSetMember{ HostSetMember: cp.(*store.HostSetMember), }