Skip to content

Commit

Permalink
File system abstraction for scan resources
Browse files Browse the repository at this point in the history
  • Loading branch information
joanlopez committed Jul 28, 2024
1 parent 96f53dc commit 04e3eb9
Show file tree
Hide file tree
Showing 13 changed files with 1,378 additions and 13 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: golangci-lint
name: Lint
on:
push:
branches:
Expand All @@ -10,12 +10,11 @@ permissions:
contents: read

jobs:
golangci:
lint:
strategy:
matrix:
go: [ '1.21.13' ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
name: lint
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permissions:
contents: write

jobs:
build:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
8 changes: 4 additions & 4 deletions cmd/gbounty/bootstrap/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func CheckForUpdates() {
updateApp := func() error { defer wg.Done(); return updateApp(update.app) }
go die.OnErr(updateApp, "Could not update the application")
} else {
pterm.Info.Printf("There is a new app version available: v%s (curr. %s)\n",
pterm.Info.Printf("There is a new app version available: %s (curr. %s)\n",
update.app.latest.Version, update.app.current)
pterm.Info.Println("Use --update or --update-app to update")
}
Expand Down Expand Up @@ -92,7 +92,7 @@ func updateApp(info updateNeeds) error {
// Which, later, will be used to replace the binary.
cmdPath, err := osext.Executable()
if err != nil {
return fmt.Errorf("failed to get the executable's path: %s", err) //nolint:err113
return fmt.Errorf("failed to get the executable's path: %s", err) //nolint:err113,errorlint
}

// When on Windows, the executable path might have the '.exe' suffix.
Expand All @@ -103,14 +103,14 @@ func updateApp(info updateNeeds) error {
// Check if the binary is a symlink.
stat, err := os.Lstat(cmdPath)
if err != nil {
return fmt.Errorf("failed to stat: %s - file may not exist: %s", cmdPath, err)
return fmt.Errorf("failed to stat: %s - file may not exist: %s", cmdPath, err) //nolint:err113
}

// If it is, we resolve the symlink.
if stat.Mode()&os.ModeSymlink != 0 {
p, err := filepath.EvalSymlinks(cmdPath)
if err != nil {
return fmt.Errorf("failed to resolve symlink: %s - for executable: %s", cmdPath, err) //nolint:err113
return fmt.Errorf("failed to resolve symlink: %s - for executable: %s", cmdPath, err) //nolint:err113,errorlint
}
cmdPath = p
}
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ require (
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/term v0.22.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
Expand Down
2 changes: 1 addition & 1 deletion internal/interfaces.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package internal
package scan

import (
"github.com/bountysecurity/gbounty/internal/profile"
Expand Down
Loading

0 comments on commit 04e3eb9

Please sign in to comment.