Skip to content

Commit

Permalink
chore: go fmt the project
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuschen committed Aug 30, 2024
1 parent eb24842 commit 391c42c
Showing 2 changed files with 59 additions and 59 deletions.
2 changes: 1 addition & 1 deletion go/analysis/passes/stdversion/main.go
Original file line number Diff line number Diff line change
@@ -8,8 +8,8 @@
package main

import (
"golang.org/x/tools/go/analysis/singlechecker"
"golang.org/x/tools/go/analysis/passes/stdversion"
"golang.org/x/tools/go/analysis/singlechecker"
)

func main() { singlechecker.Main(stdversion.Analyzer) }
116 changes: 58 additions & 58 deletions internal/imports/mod_go122_test.go
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build go1.22
// +build go1.22

package imports

import (
"context"
"testing"
)

// Tests that go.work files and vendor directory are respected.
func TestModWorkspaceVendoring(t *testing.T) {
mt := setup(t, nil, `
-- go.work --
go 1.22
use (
./a
./b
)
-- a/go.mod --
module example.com/a
go 1.22
require rsc.io/sampler v1.3.1
-- a/a.go --
package a
import _ "rsc.io/sampler"
-- b/go.mod --
module example.com/b
go 1.22
-- b/b.go --
package b
`, "")
defer mt.cleanup()

// generate vendor directory
if _, err := mt.env.invokeGo(context.Background(), "work", "vendor"); err != nil {
t.Fatal(err)
}

// update module resolver
mt.env.ClearModuleInfo()
mt.env.UpdateResolver(mt.env.resolver.ClearForNewScan())

mt.assertModuleFoundInDir("example.com/a", "a", `main/a$`)
mt.assertScanFinds("example.com/a", "a")
mt.assertModuleFoundInDir("example.com/b", "b", `main/b$`)
mt.assertScanFinds("example.com/b", "b")
mt.assertModuleFoundInDir("rsc.io/sampler", "sampler", `/vendor/`)
}
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build go1.22
// +build go1.22

package imports

import (
"context"
"testing"
)

// Tests that go.work files and vendor directory are respected.
func TestModWorkspaceVendoring(t *testing.T) {
mt := setup(t, nil, `
-- go.work --
go 1.22
use (
./a
./b
)
-- a/go.mod --
module example.com/a
go 1.22
require rsc.io/sampler v1.3.1
-- a/a.go --
package a
import _ "rsc.io/sampler"
-- b/go.mod --
module example.com/b
go 1.22
-- b/b.go --
package b
`, "")
defer mt.cleanup()

// generate vendor directory
if _, err := mt.env.invokeGo(context.Background(), "work", "vendor"); err != nil {
t.Fatal(err)
}

// update module resolver
mt.env.ClearModuleInfo()
mt.env.UpdateResolver(mt.env.resolver.ClearForNewScan())

mt.assertModuleFoundInDir("example.com/a", "a", `main/a$`)
mt.assertScanFinds("example.com/a", "a")
mt.assertModuleFoundInDir("example.com/b", "b", `main/b$`)
mt.assertScanFinds("example.com/b", "b")
mt.assertModuleFoundInDir("rsc.io/sampler", "sampler", `/vendor/`)
}

0 comments on commit 391c42c

Please sign in to comment.