MCPcopy Index your code
hub / github.com/docker/docker-agent / versionFromImport

Function versionFromImport

lint/configpath.go:31–38  ·  view source on GitHub ↗

versionFromImport returns N if importPath ends with "pkg/config/vN". Re-uses [versionFromDir] for the vN suffix, so the two helpers cannot drift apart.

(importPath string)

Source from the content-addressed store, hash-verified

29// Re-uses [versionFromDir] for the vN suffix, so the two helpers cannot
30// drift apart.
31func versionFromImport(importPath string) (int, bool) {
32 const marker = "pkg/config/"
33 idx := strings.LastIndex(importPath, marker)
34 if idx < 0 {
35 return 0, false
36 }
37 return versionFromDir(importPath[idx+len(marker):])
38}
39
40// highestSiblingVersion returns the largest N such that pkg/config/vN/
41// exists as a sibling of filename's directory. Result is cached per

Callers 2

importViolationFunction · 0.85

Calls 1

versionFromDirFunction · 0.85

Tested by

no test coverage detected