-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/stringer: use source importer when available
This means that running stringer should always have the intended effect, without having to go install the package first, which was a common source of confusion. The source importer is marginally slower, but stringer is run infrequently, and we're only typechecking one package (and fmt), not an entire tree, as vet does. Fixes golang/go#10249 Change-Id: Ib8cde29bd6cc596964dbe7348065932dd59075fc Reviewed-on: https://go-review.googlesource.com/40403 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Robert Griesemer <gri@golang.org>
- Loading branch information
Showing
4 changed files
with
34 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2017 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. | ||
|
||
// +build !go1.9 | ||
|
||
package main | ||
|
||
import ( | ||
"go/importer" | ||
"go/types" | ||
) | ||
|
||
func defaultImporter() types.Importer { | ||
return importer.Default() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2017 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. | ||
|
||
// +build go1.9 | ||
|
||
package main | ||
|
||
import ( | ||
"go/importer" | ||
"go/types" | ||
) | ||
|
||
func defaultImporter() types.Importer { | ||
return importer.For("source", nil) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters