this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cmd/cue/cmd: use goproxytest.Setup for per-test proxy modules

Use the new goproxytest.Setup function to start per-test Go module
proxy servers, embedding proxy module files directly in the txtar
test files that use them. This removes the need for the shared
testdata/mod directory and makes each test self-contained.

Signed-off-by: Roger Peppe <rogpeppe@gmail.com>
Change-Id: Ifb9cd45139e9a464202706f60e9a9985635d85f3
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1235493
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>

+102 -70
+1 -4
cmd/cue/cmd/script_test.go
··· 100 100 } 101 101 102 102 func TestScript(t *testing.T) { 103 - srv := goproxytest.NewTestServer(t, filepath.Join("testdata", "mod"), "") 104 103 p := testscript.Params{ 105 104 Dir: filepath.Join("testdata", "script"), 106 105 UpdateScripts: cuetest.UpdateGoldenFiles, ··· 364 363 } 365 364 366 365 e.Vars = append(e.Vars, 367 - "GOPROXY="+srv.URL, 368 - "GONOSUMDB=*", // GOPROXY is a private proxy 369 - 370 366 // The current language version which would be added by `cue mod init`, e.g. v0.10.0. 371 367 "CUE_LANGUAGE_VERSION="+cueversion.LanguageVersion(), 372 368 // A later language version which only increases the bugfix release, e.g. v0.10.99. ··· 439 435 if err := gotooltest.Setup(&p); err != nil { 440 436 t.Fatal(err) 441 437 } 438 + goproxytest.Setup(&p) 442 439 testscript.Run(t, p) 443 440 } 444 441
-31
cmd/cue/cmd/testdata/mod/externalmod.test_imports_v1.0.0.txtar
··· 1 - -- .mod -- 2 - module externalmod.test/imports 3 - 4 - -- .info -- 5 - {"Version":"v1.0.0","Time":"2018-10-22T18:45:39Z"} 6 - 7 - -- go.mod -- 8 - module externalmod.test/imports 9 - 10 - -- root/p.go -- 11 - package root 12 - 13 - import "externalmod.test/imports/sub1" 14 - 15 - type Type struct { 16 - Sub1 sub1.Type 17 - } 18 - -- sub1/p.go -- 19 - package sub1 20 - 21 - import "externalmod.test/imports/sub2" 22 - 23 - type Type struct { 24 - Sub2 sub2.Type 25 - } 26 - -- sub2/p.go -- 27 - package sub2 28 - 29 - type Type struct { 30 - Leaf int 31 - }
-32
cmd/cue/cmd/testdata/mod/externalmod.test_mixfiles_v1.0.0.txtar
··· 1 - -- .mod -- 2 - module externalmod.test/mixfiles 3 - 4 - -- .info -- 5 - {"Version":"v1.0.0","Time":"2018-10-22T18:45:39Z"} 6 - 7 - -- go.mod -- 8 - // A module which mixes CUE, Go, and other files, to be tested with `cue get go`. 9 - 10 - module externalmod.test/mixfiles 11 - 12 - -- aa_first_noextension -- 13 - Mix an uninteresting file at the beginning of the directory list 14 - to verify that we don't stop looking at the rest of the files. 15 - -- code_one.go -- 16 - package mixfiles 17 - 18 - // Some fruit 19 - const NameOne = "Orange" 20 - -- code_two.go -- 21 - package mixfiles 22 - 23 - const NameTwo = "Apple" 24 - -- config_one.cue -- 25 - package mixfiles 26 - 27 - Type: "Fruit" 28 - -- config_two.cue -- 29 - package mixfiles 30 - 31 - Type: string 32 - -- zz_last_noextension --
+6
cmd/cue/cmd/testdata/script/cmd_http.txtar
··· 3 3 -- cmd_http.out -- 4 4 {"Version":"v1.0.0","Time":"2018-10-22T18:45:39Z"} 5 5 6 + -- .gomodproxy/externalmod.test_imports_v1.0.0/.mod -- 7 + module externalmod.test/imports 6 8 9 + -- .gomodproxy/externalmod.test_imports_v1.0.0/.info -- 10 + {"Version":"v1.0.0","Time":"2018-10-22T18:45:39Z"} 11 + -- .gomodproxy/externalmod.test_imports_v1.0.0/go.mod -- 12 + module externalmod.test/imports 7 13 -- task_tool.cue -- 8 14 package home 9 15
+61
cmd/cue/cmd/testdata/script/get_go_non_local.txtar
··· 83 83 package mixfiles 84 84 85 85 Type: string 86 + -- .gomodproxy/externalmod.test_mixfiles_v1.0.0/.mod -- 87 + module externalmod.test/mixfiles 88 + 89 + -- .gomodproxy/externalmod.test_mixfiles_v1.0.0/.info -- 90 + {"Version":"v1.0.0","Time":"2018-10-22T18:45:39Z"} 91 + -- .gomodproxy/externalmod.test_mixfiles_v1.0.0/go.mod -- 92 + // A module which mixes CUE, Go, and other files, to be tested with `cue get go`. 93 + 94 + module externalmod.test/mixfiles 95 + 96 + -- .gomodproxy/externalmod.test_mixfiles_v1.0.0/aa_first_noextension -- 97 + Mix an uninteresting file at the beginning of the directory list 98 + to verify that we don't stop looking at the rest of the files. 99 + -- .gomodproxy/externalmod.test_mixfiles_v1.0.0/code_one.go -- 100 + package mixfiles 101 + 102 + // Some fruit 103 + const NameOne = "Orange" 104 + -- .gomodproxy/externalmod.test_mixfiles_v1.0.0/code_two.go -- 105 + package mixfiles 106 + 107 + const NameTwo = "Apple" 108 + -- .gomodproxy/externalmod.test_mixfiles_v1.0.0/config_one.cue -- 109 + package mixfiles 110 + 111 + Type: "Fruit" 112 + -- .gomodproxy/externalmod.test_mixfiles_v1.0.0/config_two.cue -- 113 + package mixfiles 114 + 115 + Type: string 116 + -- .gomodproxy/externalmod.test_mixfiles_v1.0.0/zz_last_noextension -- 117 + -- .gomodproxy/externalmod.test_imports_v1.0.0/.mod -- 118 + module externalmod.test/imports 119 + 120 + -- .gomodproxy/externalmod.test_imports_v1.0.0/.info -- 121 + {"Version":"v1.0.0","Time":"2018-10-22T18:45:39Z"} 122 + -- .gomodproxy/externalmod.test_imports_v1.0.0/go.mod -- 123 + module externalmod.test/imports 124 + 125 + -- .gomodproxy/externalmod.test_imports_v1.0.0/root/p.go -- 126 + package root 127 + 128 + import "externalmod.test/imports/sub1" 129 + 130 + type Type struct { 131 + Sub1 sub1.Type 132 + } 133 + -- .gomodproxy/externalmod.test_imports_v1.0.0/sub1/p.go -- 134 + package sub1 135 + 136 + import "externalmod.test/imports/sub2" 137 + 138 + type Type struct { 139 + Sub2 sub2.Type 140 + } 141 + -- .gomodproxy/externalmod.test_imports_v1.0.0/sub2/p.go -- 142 + package sub2 143 + 144 + type Type struct { 145 + Leaf int 146 + }
+31
cmd/cue/cmd/testdata/script/goproxytest.txtar
··· 27 27 go 1.14 28 28 29 29 require externalmod.test/mixfiles v1.0.0 30 + -- .gomodproxy/externalmod.test_mixfiles_v1.0.0/.mod -- 31 + module externalmod.test/mixfiles 32 + 33 + -- .gomodproxy/externalmod.test_mixfiles_v1.0.0/.info -- 34 + {"Version":"v1.0.0","Time":"2018-10-22T18:45:39Z"} 35 + -- .gomodproxy/externalmod.test_mixfiles_v1.0.0/go.mod -- 36 + // A module which mixes CUE, Go, and other files, to be tested with `cue get go`. 37 + 38 + module externalmod.test/mixfiles 39 + 40 + -- .gomodproxy/externalmod.test_mixfiles_v1.0.0/aa_first_noextension -- 41 + Mix an uninteresting file at the beginning of the directory list 42 + to verify that we don't stop looking at the rest of the files. 43 + -- .gomodproxy/externalmod.test_mixfiles_v1.0.0/code_one.go -- 44 + package mixfiles 45 + 46 + // Some fruit 47 + const NameOne = "Orange" 48 + -- .gomodproxy/externalmod.test_mixfiles_v1.0.0/code_two.go -- 49 + package mixfiles 50 + 51 + const NameTwo = "Apple" 52 + -- .gomodproxy/externalmod.test_mixfiles_v1.0.0/config_one.cue -- 53 + package mixfiles 54 + 55 + Type: "Fruit" 56 + -- .gomodproxy/externalmod.test_mixfiles_v1.0.0/config_two.cue -- 57 + package mixfiles 58 + 59 + Type: string 60 + -- .gomodproxy/externalmod.test_mixfiles_v1.0.0/zz_last_noextension --
+1 -1
go.mod
··· 15 15 github.com/opencontainers/image-spec v1.1.1 16 16 github.com/pelletier/go-toml/v2 v2.3.0 17 17 github.com/protocolbuffers/txtpbfmt v0.0.0-20260217160748-a481f6a22f94 18 - github.com/rogpeppe/go-internal v1.14.1 18 + github.com/rogpeppe/go-internal v1.14.2-0.20260415112238-aa1b1e25579a 19 19 github.com/spf13/cobra v1.10.2 20 20 github.com/spf13/pflag v1.0.10 21 21 github.com/tetratelabs/wazero v1.11.0
+2 -2
go.sum
··· 38 38 github.com/protocolbuffers/txtpbfmt v0.0.0-20260217160748-a481f6a22f94 h1:2PC6Ql3jipz1KvBlqUHjjk6v4aMwE86mfDu1XMH0LR8= 39 39 github.com/protocolbuffers/txtpbfmt v0.0.0-20260217160748-a481f6a22f94/go.mod h1:JSbkp0BviKovYYt9XunS95M3mLPibE9bGg+Y95DsEEY= 40 40 github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= 41 - github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= 42 - github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= 41 + github.com/rogpeppe/go-internal v1.14.2-0.20260415112238-aa1b1e25579a h1:603+lC6DvUvp1o5HHzVzBpk9arNOiiEtuK32uqlc7h8= 42 + github.com/rogpeppe/go-internal v1.14.2-0.20260415112238-aa1b1e25579a/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= 43 43 github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 44 44 github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= 45 45 github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=