()
| 336 | ) |
| 337 | |
| 338 | func init() { |
| 339 | goroot = strings.Replace(runtime.GOROOT(), "\\", "/", -1) |
| 340 | gopaths = map[string]string{} |
| 341 | for i, p := range getGOPATHs() { |
| 342 | gopaths[p] = p |
| 343 | if i == 0 { |
| 344 | gopath = p |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | // Assumes pwd == this directory. |
| 349 | pwd, err := os.Getwd() |
| 350 | if err != nil { |
| 351 | panic(err) |
| 352 | } |
| 353 | // Our internal functions work with '/' as path separator. |
| 354 | pwd = strings.Replace(pwd, "\\", "/", -1) |
| 355 | gomods = map[string]string{} |
| 356 | gmc := gomodCache{} |
| 357 | if prefix, path := gmc.isGoModule(splitPath(pwd)); prefix != "" { |
| 358 | gomods[prefix] = path |
| 359 | } |
| 360 | |
| 361 | // When inside GOPATH, no version is added. When outside, the version path is |
| 362 | // added from the reading of module statement in go.mod. |
| 363 | for _, p := range getGOPATHs() { |
| 364 | if strings.HasPrefix(pwd, p) { |
| 365 | isInGOPATH = true |
| 366 | break |
| 367 | } |
| 368 | } |
| 369 | } |
| 370 | |
| 371 | func newFunc(s string) Func { |
| 372 | f := Func{} |
nothing calls this directly
no test coverage detected
searching dependent graphs…