Skip to content

Commit 780cb69

Browse files
authored
Make sure both scripts/ can live side by side (#1264)
1 parent 42032fd commit 780cb69

File tree

2 files changed

+14
-25
lines changed

2 files changed

+14
-25
lines changed

scripts/generate-gitignores.go

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// +build !build
1+
// +build ignore
22

33
package main
44

@@ -17,17 +17,14 @@ import (
1717
"strings"
1818
)
1919

20-
var (
21-
prefix = "gitea-gitignore"
22-
url = "https://api.github.com/repos/github/gitignore/tarball"
23-
destination = ""
24-
)
20+
func main() {
21+
var (
22+
prefix = "gitea-gitignore"
23+
url = "https://api.github.com/repos/github/gitignore/tarball"
24+
destination = ""
25+
)
2526

26-
func init() {
2727
flag.StringVar(&destination, "dest", "options/gitignore/", "destination for the gitignores")
28-
}
29-
30-
func main() {
3128
flag.Parse()
3229

3330
file, err := ioutil.TempFile(os.TempDir(), prefix)

scripts/generate-licenses.go

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// +build !build
1+
// +build ignore
22

33
package main
44

@@ -17,17 +17,14 @@ import (
1717
"strings"
1818
)
1919

20-
var (
21-
prefix = "gitea-licenses"
22-
url = "https://api.github.com/repos/spdx/license-list/tarball"
23-
destination = ""
24-
)
20+
func main() {
21+
var (
22+
prefix = "gitea-licenses"
23+
url = "https://api.github.com/repos/spdx/license-list/tarball"
24+
destination = ""
25+
)
2526

26-
func init() {
2727
flag.StringVar(&destination, "dest", "options/license/", "destination for the licenses")
28-
}
29-
30-
func main() {
3128
flag.Parse()
3229

3330
file, err := ioutil.TempFile(os.TempDir(), prefix)
@@ -73,9 +70,6 @@ func main() {
7370
log.Fatalf("Failed to iterate archive. %s", err)
7471
}
7572

76-
fmt.Println(hdr.Name)
77-
fmt.Println(filepath.Ext(hdr.Name))
78-
7973
if filepath.Ext(hdr.Name) != ".txt" {
8074
continue
8175
}
@@ -88,8 +82,6 @@ func main() {
8882
continue
8983
}
9084

91-
fmt.Println(path.Join(destination, strings.TrimSuffix(filepath.Base(hdr.Name), ".txt")))
92-
9385
out, err := os.Create(path.Join(destination, strings.TrimSuffix(filepath.Base(hdr.Name), ".txt")))
9486

9587
if err != nil {

0 commit comments

Comments
 (0)