Skip to content

testscript: Missing $GOOS and $GOARCH #270

@jmgilman

Description

@jmgilman

go.mod:

require (
    github.com/rogpeppe/go-internal v1.12.1-0.20240709150035-ccf4b4329d21
)

Script:

exec forge run ./dir1+test
cmpenv stdout golden.txt

-- golden.txt --
earthly
./dir1+test
Image ./dir1+test output as test

{"$GOOS/$GOARCH":{"artifacts":{},"images":{"./dir1+test":"test"}}}

The above test returns empty values for $GOOS and $GOARCH. The documentation seems to suggest these values should be set:

[!] cmpenv file1 file2 Like cmp, but environment variables in file2 are substituted before the comparison. For example, $GOOS is replaced by the target GOOS.

Yet, running with -testwork doesn't show these variables being set:

            PATH=...
            GOTRACEBACK=system
            HOME=/no-home
            TMPDIR=$WORK/.tmp
            devnull=/dev/null
            /=/
            :=:
            $=$
            exe=

What am I missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions