Skip to content

Commit 350ad0a

Browse files
committed
Remove unused code.
Use more consistent parameter name in mustOpenAPI.
1 parent 0b05872 commit 350ad0a

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

playground/imports/fix.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package imports
66

77
import (
88
"go/ast"
9-
"go/build"
109
"go/token"
1110
"path"
1211
"strings"
@@ -147,16 +146,6 @@ func importPathToNameBasic(importPath string) (packageName string) {
147146
return path.Base(importPath)
148147
}
149148

150-
// importPathToNameGoPath finds out the actual package name, as declared in its .go files.
151-
// If there's a problem, it falls back to using importPathToNameBasic.
152-
func importPathToNameGoPath(importPath string) (packageName string) {
153-
if buildPkg, err := build.Import(importPath, "", 0); err == nil {
154-
return buildPkg.Name
155-
} else {
156-
return importPathToNameBasic(importPath)
157-
}
158-
}
159-
160149
type pkg struct {
161150
importpath string // full pkg import path, e.g. "net/http"
162151
dir string // absolute file path to pkg directory e.g. "/usr/lib/go/src/fmt"

playground/imports/mkstdlib.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ import (
2525

2626
var outputFlag = flag.String("output", "", "output file name without extension; if empty, then print to stdout")
2727

28-
func mustOpenAPI(name string) io.Reader {
29-
resp, err := http.Get("https://raw.githubusercontent.com/golang/go/master/api/" + name)
28+
func mustOpenAPI(base string) io.Reader {
29+
resp, err := http.Get("https://raw.githubusercontent.com/golang/go/master/api/" + base)
3030
if err != nil {
3131
log.Fatal(err)
3232
}

0 commit comments

Comments
 (0)