Skip to content

Commit

Permalink
fixed lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ashmeenkaur committed May 26, 2023
1 parent 3ec95b0 commit 901bd09
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
11 changes: 3 additions & 8 deletions benchmarks/write_locally/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ func run() (err error) {
// Make sure we clean it up later.
defer func() {
log.Printf("Truncating and closing %s.", path)
f.Truncate(0)
f.Close()
_ = f.Truncate(0)
_ = f.Close()

log.Printf("Deleting %s.", path)
os.Remove(path)
_ = os.Remove(path)
}()

// Extend to the initial size.
Expand Down Expand Up @@ -94,11 +94,6 @@ func run() (err error) {
// Overwrite.
var n int64
for n < *fFileSize && time.Since(start) < *fDuration {
toWrite := *fFileSize - n
if toWrite > *fWriteSize {
toWrite = *fWriteSize
}

var tmp int
tmp, err = f.Write(buf)
if err != nil {
Expand Down
6 changes: 4 additions & 2 deletions internal/perf/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/googlecloudplatform/gcsfuse/internal/logger"
)


func HandleCPUProfileSignals() {
profileOnce := func(duration time.Duration, path string) (err error) {
// Set up the file.
Expand All @@ -44,7 +43,10 @@ func HandleCPUProfileSignals() {
}()

// Profile.
pprof.StartCPUProfile(f)
err = pprof.StartCPUProfile(f)
if err != nil {
logger.Infof("StartCPUProfile failed: %v", err)
}
time.Sleep(duration)
pprof.StopCPUProfile()
return
Expand Down
3 changes: 1 addition & 2 deletions internal/perf/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const (
MiB = 1024 * KiB
)


func HandleMemoryProfileSignals() {
profileOnce := func(path string) (err error) {
// Trigger a garbage collection to get up to date information (cf.
Expand Down Expand Up @@ -70,7 +69,7 @@ func HandleMemoryProfileSignals() {

var m runtime.MemStats
runtime.ReadMemStats(&m)
logger.Infof("Heap allocation: %d MiB", m.Alloc / MiB)
logger.Infof("Heap allocation: %d MiB", m.Alloc/MiB)

err := profileOnce(path)
if err == nil {
Expand Down
2 changes: 1 addition & 1 deletion tools/package_gcsfuse/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//
// Usage:
//
// package_gcsfuse dst_dir version [commit]
// package_gcsfuse dst_dir version [commit]
//
// This will cause the gcsfuse git repo to be cloned to a temporary location
// and a build performed, embedding the given version name. The build will be
Expand Down

0 comments on commit 901bd09

Please sign in to comment.