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

Remove some named returns #228

Merged
merged 1 commit into from
Oct 5, 2023
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
9 changes: 6 additions & 3 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ type Options struct {
// Note: The agent exposes an endpoint via a TCP connection that can be used by
// any program on the system. Review your security requirements before starting
// the agent.
func Listen(opts Options) (err error) {
func Listen(opts Options) error {
mu.Lock()
defer mu.Unlock()

Expand All @@ -87,10 +87,13 @@ func Listen(opts Options) (err error) {
if addr == "" {
addr = defaultAddr
}

var lc net.ListenConfig
if opts.ReuseSocketAddrAndPort {
lc.Control = setReuseAddrAndPortSockopts
}

var err error
listener, err = lc.Listen(context.Background(), "tcp", addr)
if err != nil {
return err
Expand Down Expand Up @@ -135,7 +138,7 @@ func listen(l net.Listener) {
}
}

func saveConfig(opts Options, port int) (err error) {
func saveConfig(opts Options, port int) error {
gopsdir := opts.ConfigDir
if gopsdir == "" {
cfgDir, err := internal.ConfigDir()
Expand All @@ -145,7 +148,7 @@ func saveConfig(opts Options, port int) (err error) {
gopsdir = cfgDir
}

err = os.MkdirAll(gopsdir, os.ModePerm)
err := os.MkdirAll(gopsdir, os.ModePerm)
if errors.Is(err, syscall.EROFS) || errors.Is(err, syscall.EPERM) { // ignore and work in remote mode only
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion goprocess/goprocess.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func findAll(pss []*process.Process, isGo isGoFunc, concurrencyLimit int) []P {
}

// Find finds info about the process identified with the given PID.
func Find(pid int) (p P, ok bool, err error) {
func Find(pid int) (P, bool, error) {
pr, err := process.NewProcess(int32(pid))
if err != nil {
return P{}, false, err
Expand Down
Loading