Server : LiteSpeed System : Linux in-mum-web1333.main-hosting.eu 4.18.0-553.37.1.lve.el8.x86_64 #1 SMP Mon Feb 10 22:45:17 UTC 2025 x86_64 User : u141265441 ( 141265441) PHP Version : 8.4.3 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail Directory : /proc/self/root/opt/golang/1.22.0/src/cmd/go/testdata/script/ |
# Regression test for https://go.dev/issue/64282. # # 'go install' and 'go run' with pkg@version arguments should make # a best effort to parse flags relevant to downloading modules # (currently only -modcacherw) before actually downloading the module # to identify which toolchain version to use. # # However, the best-effort flag parsing should not interfere with # actual flag parsing if we don't switch toolchains. In particular, # unrecognized flags should still be diagnosed after the module for # the requested package has been downloaded and checked for toolchain # upgrades. ! go install -cake=delicious -modcacherw example.com/printversion@v0.1.0 stderr '^flag provided but not defined: -cake$' # Because the -modcacherw flag was set, we should be able to modify the contents # of a directory within the module cache. cp $WORK/extraneous.txt $GOPATH/pkg/mod/example.com/printversion@v0.1.0/extraneous_file.go go clean -modcache ! go install -unknownflag -tags -modcacherw example.com/printversion@v0.1.0 stderr '^flag provided but not defined: -unknownflag$' cp $WORK/extraneous.txt $GOPATH/pkg/mod/example.com/printversion@v0.1.0/extraneous_file.go go clean -modcache # Also try it with a 'go install' that succeeds. # (But skip in short mode, because linking a binary is expensive.) [!short] go install -modcacherw example.com/printversion@v0.1.0 [!short] cp $WORK/extraneous.txt $GOPATH/pkg/mod/example.com/printversion@v0.1.0/extraneous_file.go [!short] go clean -modcache # The flag should also be applied if given in GOFLAGS # instead of on the command line. env GOFLAGS=-modcacherw ! go install -cake=delicious example.com/printversion@v0.1.0 stderr '^flag provided but not defined: -cake$' cp $WORK/extraneous.txt $GOPATH/pkg/mod/example.com/printversion@v0.1.0/extraneous_file.go -- $WORK/extraneous.txt -- This is not a Go source file.