()
| 98 | ` |
| 99 | |
| 100 | func main() { |
| 101 | if verFlag { |
| 102 | log.Println(Version) |
| 103 | return |
| 104 | } |
| 105 | |
| 106 | if flag.NArg() != 5 { |
| 107 | log.Printf("Error: Invalid number of arguments (got %d, expected 5)\n\n", flag.NArg()) |
| 108 | log.Fatal(usage) |
| 109 | } |
| 110 | |
| 111 | userRepo := strings.Split(flag.Arg(0), "/") |
| 112 | if len(userRepo) != 2 { |
| 113 | log.Printf("Error: Invalid format used for username and repository: %s\n\n", flag.Arg(0)) |
| 114 | log.Fatal(usage) |
| 115 | } |
| 116 | |
| 117 | if githubToken == "" { |
| 118 | log.Fatal(`Error: GITHUB_TOKEN environment variable is not set. |
| 119 | Please refer to https://help.github.com/articles/creating-an-access-token-for-command-line-use/ for more help`) |
| 120 | } |
| 121 | |
| 122 | githubUser = userRepo[0] |
| 123 | githubRepo = userRepo[1] |
| 124 | githubAPIEndpoint = fmt.Sprintf("%s/repos/%s/%s", githubAPIEndpoint, githubUser, githubRepo) |
| 125 | |
| 126 | if debug { |
| 127 | log.Println("Glob pattern received: ") |
| 128 | log.Println(flag.Arg(4)) |
| 129 | } |
| 130 | |
| 131 | filepaths, err := filepath.Glob(flag.Arg(4)) |
| 132 | if err != nil { |
| 133 | log.Fatalf("Error: Invalid glob pattern: %s\n", flag.Arg(4)) |
| 134 | } |
| 135 | |
| 136 | if debug { |
| 137 | log.Println("Expanded glob pattern: ") |
| 138 | log.Printf("%v\n", filepaths) |
| 139 | } |
| 140 | |
| 141 | tag := flag.Arg(1) |
| 142 | branch := flag.Arg(2) |
| 143 | desc := flag.Arg(3) |
| 144 | |
| 145 | release := Release{ |
| 146 | TagName: tag, |
| 147 | Name: tag, |
| 148 | Prerelease: prereleaseFlag, |
| 149 | Draft: false, |
| 150 | Branch: branch, |
| 151 | Body: desc, |
| 152 | } |
| 153 | publishRelease(release, filepaths) |
| 154 | log.Println("Done") |
| 155 | } |
| 156 | |
| 157 | func uploadFile(uploadURL, path string) { |
nothing calls this directly
no test coverage detected