OLD | NEW |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package build | 5 package build |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 "errors" | 9 "errors" |
10 "fmt" | 10 "fmt" |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 // IsCommand reports whether the package is considered a | 314 // IsCommand reports whether the package is considered a |
315 // command to be installed (not just a library). | 315 // command to be installed (not just a library). |
316 // Packages named "main" are treated as commands. | 316 // Packages named "main" are treated as commands. |
317 func (p *Package) IsCommand() bool { | 317 func (p *Package) IsCommand() bool { |
318 return p.Name == "main" | 318 return p.Name == "main" |
319 } | 319 } |
320 | 320 |
321 // ImportDir is like Import but processes the Go package found in | 321 // ImportDir is like Import but processes the Go package found in |
322 // the named directory. | 322 // the named directory. |
323 func (ctxt *Context) ImportDir(dir string, mode ImportMode) (*Package, error) { | 323 func (ctxt *Context) ImportDir(dir string, mode ImportMode) (*Package, error) { |
324 » p, err := ctxt.Import(".", dir, mode) | 324 » return ctxt.Import(".", dir, mode) |
325 » // TODO(rsc,adg): breaks godoc net/http. Not sure why. | |
326 » // See CL 7232047 and issue 4696. | |
327 » if false && err == nil && !ctxt.isDir(p.Dir) { | |
328 » » err = fmt.Errorf("%q is not a directory", p.Dir) | |
329 » } | |
330 » return p, err | |
331 } | 325 } |
332 | 326 |
333 // NoGoError is the error used by Import to describe a directory | 327 // NoGoError is the error used by Import to describe a directory |
334 // containing no Go source files. | 328 // containing no Go source files. |
335 type NoGoError struct { | 329 type NoGoError struct { |
336 Dir string | 330 Dir string |
337 } | 331 } |
338 | 332 |
339 func (e *NoGoError) Error() string { | 333 func (e *NoGoError) Error() string { |
340 return "no Go source files in " + e.Dir | 334 return "no Go source files in " + e.Dir |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 switch goarch { | 1034 switch goarch { |
1041 case "386": | 1035 case "386": |
1042 return "8", nil | 1036 return "8", nil |
1043 case "amd64": | 1037 case "amd64": |
1044 return "6", nil | 1038 return "6", nil |
1045 case "arm": | 1039 case "arm": |
1046 return "5", nil | 1040 return "5", nil |
1047 } | 1041 } |
1048 return "", errors.New("unsupported GOARCH " + goarch) | 1042 return "", errors.New("unsupported GOARCH " + goarch) |
1049 } | 1043 } |
OLD | NEW |