Skip to content
This repository has been archived by the owner on Jan 31, 2025. It is now read-only.

Commit

Permalink
more traces to understand CI failure
Browse files Browse the repository at this point in the history
  • Loading branch information
tbruyelle committed Dec 11, 2024
1 parent c3f5171 commit 665a447
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
9 changes: 6 additions & 3 deletions internal/lsp/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,17 @@ func (s *server) TranspileAndBuild(file *GnoFile) ([]ErrorInfo, error) {
}

preOut, _ := tools.Transpile(tmpDir)
slog.Info(string(preOut))
if len(preOut) > 0 {
slog.Info("transpile error", "out", string(preOut))
return parseErrors(file, string(preOut), "transpile")
}

buildOut, _ := tools.Build(tmpDir)
slog.Info(string(buildOut))
return parseErrors(file, string(buildOut), "build")
if len(buildOut) > 0 {
slog.Info("build error", "out", string(buildOut))
return parseErrors(file, string(buildOut), "build")
}
return nil, nil
}

// This is used to extract information from the `gno build` command
Expand Down
13 changes: 12 additions & 1 deletion internal/tools/build.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
package tools

import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
)

// Build a Gno package: gno transpile -gobuild <dir>.
// TODO: Remove this in the favour of directly using tools/transpile.go
func Build(rootDir string) ([]byte, error) {
return exec.Command("gno", "transpile", "-skip-imports", "-gobuild", filepath.Join(rootDir)).CombinedOutput()
cmd := exec.Command("gno", "transpile", "-skip-imports", "-gobuild", filepath.Join(rootDir))
// FIXME(tb): See https://github.com/gnolang/gno/pull/1695/files#r1697255524
const disableGoMod = "GO111MODULE=off"
cmd.Env = append(os.Environ(), disableGoMod)
bz, err := cmd.CombinedOutput()
if err != nil {
return bz, fmt.Errorf("running '%s': %w: %s", strings.Join(cmd.Args, " "), err, string(bz))
}
return bz, nil
}
4 changes: 2 additions & 2 deletions testdata/document_open.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ lsp initialized input/initialized.json

# open document w/o errors
lsp textDocument/didOpen input/didOpen_x.json
cmpenv output/notify1.json expected/notify1.json

# open document with errors
lsp textDocument/didOpen input/didOpen_y.json
cmpenv output/notify2.json expected/notify2.json

# gno transpile should have created a *.gno.gen.go files
cmp $GNOPLS_WD/script-document_open/x.gno.gen.go x.gno.gen.go.golden
cmp $GNOPLS_WD/script-document_open/y.gno.gen.go y.gno.gen.go.golden

cmpenv output/notify1.json expected/notify1.json
cmpenv output/notify2.json expected/notify2.json
-- x.gno --
package foo

Expand Down

0 comments on commit 665a447

Please sign in to comment.