Skip to content

Commit 568836c

Browse files
committed
chore: remove 'SelfContained'
Signed-off-by: Norman <norman@samourai.coop>
1 parent c93c225 commit 568836c

File tree

8 files changed

+15
-34
lines changed

8 files changed

+15
-34
lines changed

examples/no_cycles_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var injectedTestingLibs = []string{"encoding/json", "fmt", "os", "internal/os_te
2424
// TestNoCycles checks that there is no import cycles in stdlibs and non-draft examples
2525
func TestNoCycles(t *testing.T) {
2626
// find examples and stdlibs
27-
cfg := &packages.LoadConfig{SelfContained: true, Deps: true, Fetcher: pkgdownload.NewNoopFetcher()}
27+
cfg := &packages.LoadConfig{Deps: true, Fetcher: pkgdownload.NewNoopFetcher()}
2828
pkgs, err := packages.Load(cfg, filepath.Join(gnoenv.RootDir(), "examples", "..."))
2929
require.NoError(t, err)
3030

gno.land/cmd/gnoland/start.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ func generateGenesisFile(io commands.IO, genesisFile string, privKey crypto.Priv
426426

427427
// Load examples folder
428428
examplesDir := filepath.Join(c.gnoRootDir, "examples")
429-
loadCfg := &packages.LoadConfig{IO: io, SelfContained: true}
429+
loadCfg := &packages.LoadConfig{IO: io}
430430
pkgsTxs, err := gnoland.LoadPackagesFromDir(loadCfg, examplesDir, txSender, genesisDeployFee)
431431
if err != nil {
432432
return fmt.Errorf("unable to load examples folder: %w", err)

gno.land/pkg/integration/node_testing.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88

99
"github.com/gnolang/gno/gno.land/pkg/gnoland"
1010
"github.com/gnolang/gno/gno.land/pkg/gnoland/ugnot"
11-
"github.com/gnolang/gno/gnovm/pkg/packages"
1211
abci "github.com/gnolang/gno/tm2/pkg/bft/abci/types"
1312
tmcfg "github.com/gnolang/gno/tm2/pkg/bft/config"
1413
"github.com/gnolang/gno/tm2/pkg/bft/node"
@@ -136,8 +135,7 @@ func LoadDefaultPackages(t TestingTS, creator bft.Address, gnoroot string) []gno
136135
examplesDir := filepath.Join(gnoroot, "examples")
137136

138137
defaultFee := std.NewFee(50000, std.MustParseCoin(ugnot.ValueString(1000000)))
139-
cfg := &packages.LoadConfig{SelfContained: true}
140-
txs, err := gnoland.LoadPackagesFromDir(cfg, examplesDir, creator, defaultFee)
138+
txs, err := gnoland.LoadPackagesFromDir(nil, examplesDir, creator, defaultFee)
141139
require.NoError(t, err)
142140

143141
return txs

gno.land/pkg/integration/pkgloader.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ func (pl *PkgsLoader) LoadPackages(creatorKey crypto.PrivKey, fee std.Fee, depos
8888

8989
func (pl *PkgsLoader) LoadAllPackagesFromDir(path string) error {
9090
// list all packages from target path
91-
cfg := &packages.LoadConfig{SelfContained: true}
92-
pkgslist, err := packages.Load(cfg, filepath.Join(path, "..."))
91+
pkgslist, err := packages.Load(nil, filepath.Join(path, "..."))
9392
if err != nil {
9493
return fmt.Errorf("listing gno packages: %w", err)
9594
}
@@ -105,7 +104,7 @@ func (pl *PkgsLoader) LoadAllPackagesFromDir(path string) error {
105104

106105
func (pl *PkgsLoader) LoadPackage(pkgDir string, name string) error {
107106
examples := filepath.Join(gnoenv.RootDir(), "examples", "...")
108-
cfg := &packages.LoadConfig{Deps: true, SelfContained: true, DepsPatterns: []string{examples}}
107+
cfg := &packages.LoadConfig{Deps: true, DepsPatterns: []string{examples}}
109108
pkgs, err := packages.Load(cfg, pkgDir)
110109
if err != nil {
111110
return fmt.Errorf("%q: loading: %w", pkgDir, err)

gnovm/cmd/gno/mod.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ func execModWhy(args []string, io commands.IO) error {
352352
return flag.ErrHelp
353353
}
354354

355-
conf := &packages.LoadConfig{SelfContained: true, Fetcher: testPackageFetcher}
355+
conf := &packages.LoadConfig{Fetcher: testPackageFetcher}
356356
pkgs, err := packages.Load(conf, ".")
357357
if err != nil {
358358
return err

gnovm/pkg/packages/expand_patterns.go

-6
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,6 @@ func expandPatterns(conf *LoadConfig, patterns ...string) ([]*pkgMatch, error) {
9090
switch patKind {
9191
case patternKindRecursiveRemote:
9292
return nil, fmt.Errorf("%s: recursive remote patterns are not supported", match)
93-
94-
case patternKindRemote:
95-
// XXX: weird
96-
if conf.SelfContained {
97-
return nil, fmt.Errorf("%s: remote patterns are not supported in self-contained mode", match)
98-
}
9993
case patternKindSingleFile:
10094
return nil, fmt.Errorf("unexpected single pattern at this point")
10195
}

gnovm/pkg/packages/load.go

+7-16
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,13 @@ import (
2222
// FIXME: should not include pkgs imported in test except for matches and only when Test flag is set
2323

2424
type LoadConfig struct {
25-
IO commands.IO
26-
Fetcher pkgdownload.PackageFetcher
27-
Deps bool
28-
Cache PkgList
29-
SelfContained bool
30-
AllowEmpty bool
31-
DepsPatterns []string
32-
Fset *token.FileSet
25+
IO commands.IO
26+
Fetcher pkgdownload.PackageFetcher
27+
Deps bool
28+
Cache PkgList
29+
AllowEmpty bool
30+
DepsPatterns []string
31+
Fset *token.FileSet
3332
}
3433

3534
var injectedTestingLibs = []string{"encoding/json", "fmt", "internal/os_test", "os"}
@@ -161,14 +160,6 @@ func Load(conf *LoadConfig, patterns ...string) (PkgList, error) {
161160
continue
162161
}
163162

164-
if conf.SelfContained {
165-
pkg.Errors = append(pkg.Errors, &Error{
166-
Pos: pkg.Dir,
167-
Msg: fmt.Sprintf("package %q not found (self-contained)", imp.PkgPath),
168-
})
169-
continue
170-
}
171-
172163
dir := gnomod.PackageDir("", module.Version{Path: imp.PkgPath})
173164
if err := downloadPackage(conf, imp.PkgPath, dir); err != nil {
174165
pkg.Errors = append(pkg.Errors, &Error{

gnovm/pkg/packages/load_test.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,8 @@ func TestSortPkgs(t *testing.T) {
169169
func TestLoadNonDraftExamples(t *testing.T) {
170170
examples := filepath.Join("..", "..", "..", "examples", "...")
171171
conf := LoadConfig{
172-
Deps: true,
173-
Fetcher: pkgdownload.NewNoopFetcher(),
174-
SelfContained: true,
172+
Deps: true,
173+
Fetcher: pkgdownload.NewNoopFetcher(),
175174
}
176175

177176
pkgs, err := Load(&conf, examples)

0 commit comments

Comments
 (0)