Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore]: enable whitespace linter globally #36355

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ linters:
- unused
- usestdlibvars
- wastedassign
- whitespace

issues:
# Excluding configuration per-path, per-linter, per-text and per-source
Expand Down
2 changes: 0 additions & 2 deletions cmd/checkapi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ func handleFile(f *ast.File, result *api) {
result.Structs = append(result.Structs, t.Name.String())
}
}

}
}
if fn, isFn := d.(*ast.FuncDecl); isFn {
Expand All @@ -112,7 +111,6 @@ func handleFile(f *ast.File, result *api) {
exported = true
}
if fn.Recv.NumFields() > 0 {

for _, t := range fn.Recv.List {
for _, n := range t.Names {
exported = exported || n.IsExported()
Expand Down
1 change: 0 additions & 1 deletion cmd/githubgen/issuetemplates.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ func (itg issueTemplatesGenerator) generate(data *githubData) error {
return err
}
}

}
return nil
}
1 change: 0 additions & 1 deletion cmd/githubgen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ func loadMetadata(filePath string) (metadata, error) {
}

func run(folder string, allowlistFilePath string, generators []generator) error {

components := map[string]metadata{}
var foldersList []string
maxLength := 0
Expand Down
1 change: 0 additions & 1 deletion cmd/opampsupervisor/main_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ func run() error {
// ignore this error and only return other errors
return fmt.Errorf("alloc console: %w", err)
}

}
defer func() {
_ = freeConsole()
Expand Down
1 change: 0 additions & 1 deletion cmd/opampsupervisor/supervisor/persistence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ func TestCreateOrLoadPersistentState(t *testing.T) {
require.Equal(t, uuid.MustParse("018feed6-905b-7aa6-ba37-b0eec565de03"), state.InstanceID)
require.FileExists(t, f)
})

}

func TestPersistentState_SetInstanceID(t *testing.T) {
Expand Down
2 changes: 0 additions & 2 deletions cmd/opampsupervisor/supervisor/supervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,6 @@ func (s *Supervisor) setupOwnMetrics(_ context.Context, settings *protobufs.Tele
s.logger.Error("Could not setup own metrics", zap.Error(err))
return
}

}
s.agentConfigOwnMetricsSection.Store(cfg.String())

Expand Down Expand Up @@ -1274,7 +1273,6 @@ func (s *Supervisor) onMessage(ctx context.Context, msg *types.MessageData) {

// Update the agent config if any messages have touched the config
if configChanged {

err := s.opampClient.UpdateEffectiveConfig(ctx)
if err != nil {
s.logger.Error("The OpAMP client failed to update the effective config", zap.Error(err))
Expand Down
10 changes: 0 additions & 10 deletions cmd/opampsupervisor/supervisor/supervisor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ func Test_onMessage(t *testing.T) {
require.Contains(t, mergedCfg, "runtime.type: test")
})
t.Run("RemoteConfig - Remote Config message is processed and merged into local config", func(t *testing.T) {

const testConfigMessage = `receivers:
debug:`

Expand Down Expand Up @@ -468,7 +467,6 @@ service:
assert.True(t, remoteConfigStatusUpdated)
})
t.Run("RemoteConfig - Remote Config message is processed but OpAmp Client fails", func(t *testing.T) {

const testConfigMessage = `receivers:
debug:`

Expand Down Expand Up @@ -567,7 +565,6 @@ service:
assert.True(t, remoteConfigStatusUpdated)
})
t.Run("RemoteConfig - Invalid Remote Config message is detected and status is set appropriately", func(t *testing.T) {

const testConfigMessage = `invalid`

remoteConfig := &protobufs.AgentRemoteConfig{
Expand Down Expand Up @@ -635,7 +632,6 @@ service:
assert.Nil(t, s.cfgState.Load())
assert.True(t, remoteConfigStatusUpdated)
})

}

func Test_handleAgentOpAMPMessage(t *testing.T) {
Expand Down Expand Up @@ -1165,7 +1161,6 @@ service:
}

func TestSupervisor_createEffectiveConfigMsg(t *testing.T) {

t.Run("empty config", func(t *testing.T) {
s := Supervisor{
effectiveConfig: &atomic.Value{},
Expand Down Expand Up @@ -1200,13 +1195,10 @@ func TestSupervisor_createEffectiveConfigMsg(t *testing.T) {

assert.Equal(t, []byte("merged"), got.ConfigMap.ConfigMap[""].Body)
})

}

func TestSupervisor_loadAndWriteInitialMergedConfig(t *testing.T) {

t.Run("load initial config", func(t *testing.T) {

configDir := t.TempDir()

const testLastReceivedRemoteConfig = `receiver:
Expand Down Expand Up @@ -1328,11 +1320,9 @@ service:
replacedMergedConfig := portRegex.ReplaceAll([]byte(gotMergedConfig), []byte(":55555"))
assert.Equal(t, expectedMergedConfig, string(replacedMergedConfig))
})

}

func TestSupervisor_composeNoopConfig(t *testing.T) {

const expectedConfig = `exporters:
nop: null
extensions:
Expand Down
1 change: 0 additions & 1 deletion cmd/telemetrygen/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func init() {
// Disabling completion command for end user
// https://github.com/spf13/cobra/blob/master/shell_completions.md
rootCmd.CompletionOptions.DisableDefaultCmd = true

}

// Execute tries to run the input command
Expand Down
1 change: 0 additions & 1 deletion cmd/telemetrygen/internal/logs/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ func (w worker) simulateLogs(res *resource.Resource, exporterFunc func() (sdklog
}()

for w.running.Load() {

var tid trace.TraceID
var sid trace.SpanID

Expand Down
1 change: 0 additions & 1 deletion cmd/telemetrygen/internal/metrics/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ func (c *Config) Flags(fs *pflag.FlagSet) {

fs.StringVar(&c.TraceID, "trace-id", "", "TraceID to use as exemplar")
fs.StringVar(&c.SpanID, "span-id", "", "SpanID to use as exemplar")

}

// Validate validates the test scenario parameters.
Expand Down
1 change: 0 additions & 1 deletion cmd/telemetrygen/internal/traces/worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,5 +391,4 @@ func configWithMultipleAttributes(qty int, statusCode string) *Config {
NumTraces: qty,
StatusCode: statusCode,
}

}
2 changes: 0 additions & 2 deletions confmap/provider/aesprovider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func (*provider) Shutdown(context.Context) error {
}

func (p *provider) Retrieve(_ context.Context, uri string, _ confmap.WatcherFunc) (*confmap.Retrieved, error) {

if !strings.HasPrefix(uri, schemaName+":") {
return nil, fmt.Errorf("%q uri is not supported by %q provider", uri, schemaName)
}
Expand Down Expand Up @@ -76,7 +75,6 @@ func (p *provider) Retrieve(_ context.Context, uri string, _ confmap.WatcherFunc
}

func (p *provider) decrypt(cipherText string) (string, error) {

cipherBytes, err := base64.StdEncoding.DecodeString(cipherText)
if err != nil {
return "", err
Expand Down
1 change: 0 additions & 1 deletion confmap/provider/aesprovider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
)

func TestAESCredentialProvider(t *testing.T) {

tests := []struct {
name string
configValue string
Expand Down
1 change: 0 additions & 1 deletion confmap/provider/s3provider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ func TestFunctionalityS3URISplit(t *testing.T) {
}

func TestURIs(t *testing.T) {

tests := []struct {
name string
uri string
Expand Down
1 change: 0 additions & 1 deletion examples/demo/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ func main() {
}

func makeRequest(ctx context.Context) {

demoServerAddr, ok := os.LookupEnv("DEMO_SERVER_ENDPOINT")
if !ok {
demoServerAddr = "http://0.0.0.0:7080/hello"
Expand Down
1 change: 0 additions & 1 deletion examples/demo/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ func main() {
http.Error(w, "write operation failed.", http.StatusInternalServerError)
return
}

})

mux := http.NewServeMux()
Expand Down