(arg string)
| 47 | } |
| 48 | |
| 49 | func splitModule(arg string) (module, version string, err error) { |
| 50 | const versionSplit = "@" |
| 51 | |
| 52 | // accommodate module paths that have @ in them, but we can only tolerate that if there's also |
| 53 | // a version, otherwise we don't know if it's a version separator or part of the file path |
| 54 | lastVersionSplit := strings.LastIndex(arg, versionSplit) |
| 55 | if lastVersionSplit < 0 { |
| 56 | module = arg |
| 57 | } else { |
| 58 | module, version = arg[:lastVersionSplit], arg[lastVersionSplit+1:] |
| 59 | } |
| 60 | |
| 61 | if module == "" { |
| 62 | err = fmt.Errorf("module name is required") |
| 63 | } |
| 64 | |
| 65 | return module, version, err |
| 66 | } |
| 67 | |
| 68 | func cmdAddPackage(fl Flags) (int, error) { |
| 69 | if len(fl.Args()) == 0 { |
no outgoing calls
no test coverage detected