Skip to content

Commit

Permalink
faster CI
Browse files Browse the repository at this point in the history
  • Loading branch information
akhenakh committed Sep 17, 2024
1 parent 3bda1c0 commit 66d38a6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@ jobs:
with:
go-version: '1.23'

- name: download vendor
run: go mod vendor

- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.60.3

args: --timeout=5m --modules-download-mode=vendor ./...

- name: Test
run: go test -v ./...
run: go test -race -mod=vendor -v ./...

- name: Build
run: go build -v ./...
run: go build -mod=vendor -v ./...


10 changes: 6 additions & 4 deletions cmd/sshjump/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type Server struct {
clientset *kubernetes.Clientset
configWatcher *fsnotify.Watcher

mu sync.Mutex
mu sync.RWMutex
permissions map[string]Permission
}

Expand Down Expand Up @@ -108,9 +108,11 @@ func (srv *Server) Handler(s ssh.Session) {
select {}
}

// PermsForUser returns the permissions for a given user.
// It locks the server mutex to ensure safe access to the permissions map.
func (srv *Server) PermsForUser(user string) *Permission {
srv.mu.Lock()
defer srv.mu.Unlock()
srv.mu.RLock()
defer srv.mu.RUnlock()

// looking for a matching username
perm, ok := srv.permissions[user]
Expand Down Expand Up @@ -326,7 +328,7 @@ func (srv *Server) StartWatchConfig(ctx context.Context, path string) error {
if !ok {
return
}
srv.logger.Error("error watching config file: %v", err)
srv.logger.Error("error watching config file: %v", err.Error())
}
}
}()
Expand Down

0 comments on commit 66d38a6

Please sign in to comment.