Skip to content

Commit fd08bf7

Browse files
committed
linter fixes
1 parent 3602556 commit fd08bf7

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

cmd/bspagent/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ var (
5353
proofChainFlag string
5454
binaryFilePathFlag string
5555
websocketURLsFlag string
56-
logsFolderFlag string = "./logs/"
56+
logsFolderFlag = "./logs/"
5757

5858
// stream processing vars
5959
start = ">"
@@ -315,7 +315,7 @@ func getLogLocationURL(logPath string) (*url.URL, error) {
315315
// directory doesn't exist, create
316316
createErr := os.Mkdir(locationURL.Path, os.ModePerm)
317317
if createErr != nil {
318-
return nil, fmt.Errorf("error creating the directory: %v", createErr)
318+
return nil, fmt.Errorf("error creating the directory: %w", createErr)
319319
}
320320
}
321321

@@ -324,7 +324,7 @@ func getLogLocationURL(logPath string) (*url.URL, error) {
324324
}
325325
}
326326

327-
return locationURL, err
327+
return locationURL, fmt.Errorf("log-location: %w", err)
328328
}
329329

330330
func writable(path string) bool {

internal/utils/utils.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,14 @@ func DecodeAvro(record avro.AvroRecord, buffer []byte) error {
174174
// 2. expands embedded environment variables
175175
// 3. cleans the path, e.g. /a/b/../c -> /a/c
176176
// Note, it has limitations, e.g. ~someuser/tmp will not be expanded
177-
func ExpandPath(p string) string {
178-
if strings.HasPrefix(p, "~/") || strings.HasPrefix(p, "~\\") {
177+
func ExpandPath(fsPath string) string {
178+
if strings.HasPrefix(fsPath, "~/") || strings.HasPrefix(fsPath, "~\\") {
179179
if home := HomeDir(); home != "" {
180-
p = home + p[1:]
180+
fsPath = home + fsPath[1:]
181181
}
182182
}
183-
return path.Clean(os.ExpandEnv(p))
183+
184+
return path.Clean(os.ExpandEnv(fsPath))
184185
}
185186

186187
// HomeDir returns full path of home directory for current user
@@ -191,5 +192,6 @@ func HomeDir() string {
191192
if usr, err := user.Current(); err == nil {
192193
return usr.HomeDir
193194
}
195+
194196
return ""
195197
}

0 commit comments

Comments
 (0)