-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
apply the megacheck code vetting tool for idiomatic go #3949
Changes from 2 commits
f9ba45d
c5df8f0
096b323
0b58458
ae4cad3
b77d5aa
6c064d1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,16 +38,16 @@ import ( | |
var log = logging.Logger("cmd/ipfs") | ||
|
||
var ( | ||
errUnexpectedApiOutput = errors.New("api returned unexpected output") | ||
errApiVersionMismatch = errors.New("api version mismatch") | ||
errRequestCanceled = errors.New("request canceled") | ||
// errUnexpectedApiOutput = errors.New("api returned unexpected output") | ||
// errApiVersionMismatch = errors.New("api version mismatch") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if its actually not being used, should probably just remove it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. roger. |
||
errRequestCanceled = errors.New("request canceled") | ||
) | ||
|
||
const ( | ||
EnvEnableProfiling = "IPFS_PROF" | ||
cpuProfile = "ipfs.cpuprof" | ||
heapProfile = "ipfs.memprof" | ||
errorFormat = "ERROR: %v\n\n" | ||
// errorFormat = "ERROR: %v\n\n" | ||
) | ||
|
||
type cmdInvocation struct { | ||
|
@@ -492,7 +492,7 @@ func startProfiling() (func(), error) { | |
} | ||
pprof.StartCPUProfile(ofi) | ||
go func() { | ||
for _ = range time.NewTicker(time.Second * 30).C { | ||
for range time.NewTicker(time.Second * 30).C { | ||
err := writeHeapProfileToFile() | ||
if err != nil { | ||
log.Error(err) | ||
|
@@ -546,7 +546,7 @@ func (ih *IntrHandler) Handle(handler func(count int, ih *IntrHandler), sigs ... | |
go func() { | ||
defer ih.wg.Done() | ||
count := 0 | ||
for _ = range ih.sig { | ||
for range ih.sig { | ||
count++ | ||
handler(count, ih) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ import ( | |
"os" | ||
"os/signal" | ||
"path/filepath" | ||
"syscall" | ||
|
||
commands "github.com/ipfs/go-ipfs/commands" | ||
core "github.com/ipfs/go-ipfs/core" | ||
|
@@ -99,7 +100,7 @@ func run(ipfsPath, watchPath string) error { | |
} | ||
|
||
interrupts := make(chan os.Signal) | ||
signal.Notify(interrupts, os.Interrupt, os.Kill) | ||
signal.Notify(interrupts, os.Interrupt, syscall.SIGTERM) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the error message is: |
||
|
||
for { | ||
select { | ||
|
@@ -167,10 +168,7 @@ func addTree(w *fsnotify.Watcher, root string) error { | |
} | ||
return nil | ||
}) | ||
if err != nil { | ||
return err | ||
} | ||
return nil | ||
return err | ||
} | ||
|
||
func IsDirectory(path string) (bool, error) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add this target to
mk/golang.mk
instead and add comment about it to help print section.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done