MCPcopy Index your code
hub / github.com/maruel/panicparse / init

Function init

stack/stack_test.go:338–369  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

336)
337
338func 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
371func newFunc(s string) Func {
372 f := Func{}

Callers

nothing calls this directly

Calls 3

isGoModuleMethod · 0.95
getGOPATHsFunction · 0.85
splitPathFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…