Merge pull request #4401 from hashicorp/jefferai-linter-fixes
Fix linter warnings, parts 1 and 2
This commit is contained in:
91 files changed
+472
-411
No files matched your search
@@ -78,21 +78,21 @@ func (h *Host) GetAddress() string {
|
||||
}
|
||||
|
||||
// TableName returns the table name for the host set.
|
||||
func (s *Host) TableName() string {
|
||||
if s.tableName != "" {
|
||||
return s.tableName
|
||||
func (h Host) TableName() string {
|
||||
if h.tableName != "" {
|
||||
return h.tableName
|
||||
}
|
||||
return "host_plugin_host"
|
||||
}
|
||||
|
||||
// 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 *Host) SetTableName(n string) {
|
||||
s.tableName = n
|
||||
func (h *Host) SetTableName(n string) {
|
||||
h.tableName = n
|
||||
}
|
||||
|
||||
// GetResourceType returns the resource type of the Host
|
||||
func (s *Host) GetResourceType() resource.Type {
|
||||
func (h Host) GetResourceType() resource.Type {
|
||||
return resource.Host
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ func (r *OrphanedHostCleanupJob) Status() scheduler.JobStatus {
|
||||
// will be returned.
|
||||
func (r *OrphanedHostCleanupJob) Run(ctx context.Context) error {
|
||||
const op = "plugin.(OrphanedHostCleanupJob).Run"
|
||||
if !r.running.CAS(r.running.Load(), true) {
|
||||
if !r.running.CompareAndSwap(r.running.Load(), true) {
|
||||
return errors.New(ctx, errors.JobAlreadyRunning, op, "job already running")
|
||||
}
|
||||
defer r.running.Store(false)
|
||||
|
||||
@@ -87,7 +87,7 @@ func (r *SetSyncJob) Status() scheduler.JobStatus {
|
||||
// will be returned.
|
||||
func (r *SetSyncJob) Run(ctx context.Context) error {
|
||||
const op = "plugin.(SetSyncJob).Run"
|
||||
if !r.running.CAS(r.running.Load(), true) {
|
||||
if !r.running.CompareAndSwap(r.running.Load(), true) {
|
||||
return errors.New(ctx, errors.JobAlreadyRunning, op, "job already running")
|
||||
}
|
||||
defer r.running.Store(false)
|
||||
|
||||
@@ -745,11 +745,11 @@ func (r *Repository) DeleteSet(ctx context.Context, projectId string, publicId s
|
||||
if err != nil {
|
||||
return 0, errors.Wrap(ctx, err, op)
|
||||
}
|
||||
_, err = plgClient.OnDeleteSet(ctx, &plgpb.OnDeleteSetRequest{Catalog: plgHc, Persisted: p, Set: plgHs})
|
||||
if err != nil {
|
||||
// Even if the plugin returns an error, we ignore it and proceed
|
||||
// with deleting the set.
|
||||
}
|
||||
// Even if the plugin returns an error, we ignore it and proceed with
|
||||
// deleting the set, hence we don't check the error here. This is because we
|
||||
// may get errors from the plugin that we can't do anything about (say, it's
|
||||
// already deleted) and we still want to delete the set from the database.
|
||||
_, _ = plgClient.OnDeleteSet(ctx, &plgpb.OnDeleteSetRequest{Catalog: plgHc, Persisted: p, Set: plgHs})
|
||||
|
||||
oplogWrapper, err := r.kms.GetWrapper(ctx, projectId, kms.KeyPurposeOplog)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user