Fix linter warnings (#4219)

This commit is contained in:
Johan Brandhorst-Satzkorn committed 2024-01-05 07:43:22 -08:00
1 parent 69262c386c
commit 1303f7c363
11 files changed
+31 -25

No files matched your search

+1 -1
View File
@@ -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
+1 -1
View File
@@ -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"
}
+10 -10
View File
@@ -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
}
+3 -1
View File
@@ -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),
)
}
@@ -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")
@@ -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
@@ -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()
@@ -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, "")
@@ -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))
+1 -1
View File
@@ -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"
}
@@ -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),
}