From e4684f63cf82c417fc013d9f998a3608c3417e9a Mon Sep 17 00:00:00 2001 From: Paul Johnston Date: Mon, 5 Aug 2024 22:41:08 -0600 Subject: [PATCH] Add parse request debugging --- pkg/parser/scalameta_parser.go | 2 ++ pkg/provider/source_provider.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/parser/scalameta_parser.go b/pkg/parser/scalameta_parser.go index 9921a1b..bbda26e 100644 --- a/pkg/parser/scalameta_parser.go +++ b/pkg/parser/scalameta_parser.go @@ -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) diff --git a/pkg/provider/source_provider.go b/pkg/provider/source_provider.go index a53adaa..4db64e6 100644 --- a/pkg/provider/source_provider.go +++ b/pkg/provider/source_provider.go @@ -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