Skip to content

Commit

Permalink
Bump go.mod to 1.21 (#417)
Browse files Browse the repository at this point in the history
* Bump go.mod to 1.21

This should unblock some currently pending updates. Each major Go release is supported until there are two newer major releases and the newest major version is 1.22, so 1.19 has been unsupported for a while.

We'd previously tried this six months ago and reverted in #357. The cases we had where we wanted an older version should no longer apply.

Prometheus libraries (#415) are the current dependency where newer versions need newer go compilers.

* Address go lint errors

* Add in process test changes from #344
  • Loading branch information
sfc-gh-srhodes authored Apr 3, 2024
1 parent 4fa5332 commit 1a63cc8
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 22 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/Snowflake-Labs/sansshell

go 1.19
go 1.21

require (
github.com/coreos/go-systemd/v22 v22.5.0
Expand Down
29 changes: 29 additions & 0 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions proxy/server/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,3 @@ func (u *unconnectedClientStream) SendMsg(interface{}) error {
func (u *unconnectedClientStream) RecvMsg(interface{}) error {
return fmt.Errorf("%w: RecvMsg", errUnconnectedClient)
}

func init() {
rand.Seed(time.Now().UnixNano())
}
22 changes: 15 additions & 7 deletions services/process/server/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func (s *server) GetStacks(ctx context.Context, req *pb.GetStacksRequest) (*pb.G
// New thread so append last entry and start over.
if fields[0] == "Thread" {
// Depending on wrapper/gdb this may have additional fields but we don't need them.
if len(fields) < 6 {
if len(fields) < 4 {
recorder.CounterOrLog(ctx, processGetStacksFailureCounter, 1, attribute.String("reason", "parse_err"))
return nil, status.Errorf(codes.Internal, "unparsable pstack output for new thread: %s", text)
}
Expand All @@ -244,13 +244,21 @@ func (s *server) GetStacks(ctx context.Context, req *pb.GetStacksRequest) (*pb.G
recorder.CounterOrLog(ctx, processGetStacksFailureCounter, 1, attribute.String("reason", "parse_err"))
return nil, status.Errorf(codes.Internal, "can't parse thread number: %s : %v", text, err)
}
if n, err := fmt.Sscanf(fields[3], "0x%x", &stack.ThreadId); n != 1 || err != nil {
recorder.CounterOrLog(ctx, processGetStacksFailureCounter, 1, attribute.String("reason", "parse_err"))
return nil, status.Errorf(codes.Internal, "can't parse thread id: %s : %v", text, err)
if fields[2] == "(Thread" && len(fields) >= 6 {
if n, err := fmt.Sscanf(fields[3], "0x%x", &stack.ThreadId); n != 1 || err != nil {
recorder.CounterOrLog(ctx, processGetStacksFailureCounter, 1, attribute.String("reason", "parse_err"))
return nil, status.Errorf(codes.Internal, "can't parse thread id: %s : %v", text, err)
}
if n, err := fmt.Sscanf(fields[5], "%d", &stack.Lwp); n != 1 || err != nil {
recorder.CounterOrLog(ctx, processGetStacksFailureCounter, 1, attribute.String("reason", "parse_err"))
return nil, status.Errorf(codes.Internal, "can't parse lwp: %s : %v", text, err)
}
}
if n, err := fmt.Sscanf(fields[5], "%d", &stack.Lwp); n != 1 || err != nil {
recorder.CounterOrLog(ctx, processGetStacksFailureCounter, 1, attribute.String("reason", "parse_err"))
return nil, status.Errorf(codes.Internal, "can't parse lwp: %s : %v", text, err)
if fields[2] == "(LWP" {
if n, err := fmt.Sscanf(fields[3], "%d", &stack.Lwp); n != 1 || err != nil {
recorder.CounterOrLog(ctx, processGetStacksFailureCounter, 1, attribute.String("reason", "parse_err"))
return nil, status.Errorf(codes.Internal, "can't parse lwp: %s : %v", text, err)
}
}
numEntries++
continue
Expand Down
Loading

0 comments on commit 1a63cc8

Please sign in to comment.