Skip to content

Commit

Permalink
Remove named returns
Browse files Browse the repository at this point in the history
Named returns should only be used with naked returns, or a
deferred function. And in general are better avoided
  • Loading branch information
glibsm committed Oct 5, 2023
1 parent dae615b commit 265df78
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 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 Down Expand Up @@ -135,7 +135,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 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

0 comments on commit 265df78

Please sign in to comment.