Skip to content

Commit

Permalink
Add parse request debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
pcj committed Aug 6, 2024
1 parent cab4f2c commit e4684f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pkg/parser/scalameta_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ func newHttpParseRequest(url string, in *sppb.ParseRequest) (*http.Request, erro
return nil, status.Errorf(codes.InvalidArgument, "marshaling request: %v", err)
}

log.Println("parse request:", json)

req, err := http.NewRequest("POST", url, bytes.NewBuffer(json))
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, "creating request: %v", err)
Expand Down
4 changes: 2 additions & 2 deletions pkg/provider/source_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ func (r *SourceProvider) parseFiles(dir string, srcs []string) ([]*sppb.File, er

// remove dir prefixes
for _, file := range response.Files {
// TODO(pcj): isn't there a stdlib function that does this?
file.Filename = strings.TrimPrefix(strings.TrimPrefix(file.Filename, dir), "/")
if strings.ContainsRune(file.Filename, ',') {
log.Panicln("parseFiles output filename contains a comma:", file.Filename)
}
// TODO(pcj): isn't there a stdlib function that does this?
file.Filename = strings.TrimPrefix(strings.TrimPrefix(file.Filename, dir), "/")
}

return response.Files, nil
Expand Down

0 comments on commit e4684f6

Please sign in to comment.