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

Update imports to elastic-agent-libs/file where needed #31419

Merged
merged 18 commits into from
Apr 29, 2022
Prev Previous commit
Next Next commit
fixed issues reported by linter
  • Loading branch information
kvch committed Apr 28, 2022
commit d0350f5d0c7dd097a4d987eec3bdc55310897e9d
3 changes: 1 addition & 2 deletions dev-tools/mage/crossbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ func buildMage() error {
"-compile", CreateDir(filepath.Join("build", "mage-linux-"+arch)))
}

//nolint:goconst // unnecessary consts
func CrossBuildImage(platform string) (string, error) {
tagSuffix := "main"

Expand Down Expand Up @@ -270,7 +269,7 @@ type GolangCrossBuilder struct {

// Build executes the build inside of Docker.
func (b GolangCrossBuilder) Build() error {
fmt.Printf(">> %v: Building for %v\n", b.Target, b.Platform) //nolint:forbidigo // it's ok to fmt.println in mage
fmt.Printf(">> %v: Building for %v\n", b.Target, b.Platform)

repoInfo, err := GetProjectRepoInfo()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion filebeat/inputsource/unix/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ func TestReceiveNewEventsConcurrently(t *testing.T) {
}

for socketType := range socketTypes {
if runtime.GOOS == "darwin" && socketType == "datagram" { //nolint:goconst // platform checking in test
if runtime.GOOS == "darwin" && socketType == "datagram" {
t.Skip("test is only supported on linux. See https://github.com/elastic/beats/issues/22775")
return
}
Expand Down
14 changes: 7 additions & 7 deletions libbeat/cmd/instance/beat.go
Original file line number Diff line number Diff line change
Expand Up @@ -649,13 +649,13 @@ func (b *Beat) configure(settings Settings) error {
// options.
store, err := LoadKeystore(cfg, b.Info.Beat)
if err != nil {
return fmt.Errorf("could not initialize the keystore: %v", err)
return fmt.Errorf("could not initialize the keystore: %w", err)
}

if settings.DisableConfigResolver {
common.OverwriteConfigOpts(obfuscateConfigOpts())
} else {
// Must allow the options to be more flexible for dynamic changes
// TODO: Allow the options to be more flexible for dynamic changes
common.OverwriteConfigOpts(configOpts(store))
}

Expand All @@ -675,7 +675,7 @@ func (b *Beat) configure(settings Settings) error {
b.RawConfig = cfg
err = cfg.Unpack(&b.Config)
if err != nil {
return fmt.Errorf("error unpacking config data: %v", err)
return fmt.Errorf("error unpacking config data: %w", err)
}

b.Beat.Config = &b.Config.BeatConfig
Expand All @@ -685,7 +685,7 @@ func (b *Beat) configure(settings Settings) error {
}

if err := configure.Logging(b.Info.Beat, b.Config.Logging); err != nil {
return fmt.Errorf("error initializing logging: %v", err)
return fmt.Errorf("error initializing logging: %w", err)
}

// log paths values to help with troubleshooting
Expand Down Expand Up @@ -756,7 +756,7 @@ func (b *Beat) loadMeta(metaPath string) error {

if err == nil {
m := meta{}
if err := json.NewDecoder(f).Decode(&m); err != nil && err != io.EOF {
if err := json.NewDecoder(f).Decode(&m); err != nil && err != io.EOF { //nolint:errorlint // keep old behaviour
f.Close()
return fmt.Errorf("Beat meta file reading error: %v", err)
}
Expand Down Expand Up @@ -883,7 +883,7 @@ func (b *Beat) checkElasticsearchVersion() {
return
}

elasticsearch.RegisterGlobalCallback(func(conn *eslegclient.Connection) error {
_ = elasticsearch.RegisterGlobalCallback(func(conn *eslegclient.Connection) error {
esVersion := conn.GetVersion()
beatVersion, err := common.NewVersion(b.Info.Version)
if err != nil {
Expand All @@ -901,7 +901,7 @@ func (b *Beat) isConnectionToOlderVersionAllowed() bool {
AllowOlder bool `config:"allow_older_versions"`
}{false}

b.Config.Output.Config().Unpack(&config)
_ = b.Config.Output.Config().Unpack(&config)

return config.AllowOlder
}
Expand Down