Browse Source

Make sure both scripts/ can live side by side (#1264)

Thomas Boerger 2 years ago
parent
commit
780cb692d6
2 changed files with 14 additions and 25 deletions
  1. 7 10
      scripts/generate-gitignores.go
  2. 7 15
      scripts/generate-licenses.go

+ 7 - 10
scripts/generate-gitignores.go

@@ -1,4 +1,4 @@
1
-// +build !build
1
+// +build ignore
2 2
 
3 3
 package main
4 4
 
@@ -17,17 +17,14 @@ import (
17 17
 	"strings"
18 18
 )
19 19
 
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
+	)
25 26
 
26
-func init() {
27 27
 	flag.StringVar(&destination, "dest", "options/gitignore/", "destination for the gitignores")
28
-}
29
-
30
-func main() {
31 28
 	flag.Parse()
32 29
 
33 30
 	file, err := ioutil.TempFile(os.TempDir(), prefix)

+ 7 - 15
scripts/generate-licenses.go

@@ -1,4 +1,4 @@
1
-// +build !build
1
+// +build ignore
2 2
 
3 3
 package main
4 4
 
@@ -17,17 +17,14 @@ import (
17 17
 	"strings"
18 18
 )
19 19
 
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
+	)
25 26
 
26
-func init() {
27 27
 	flag.StringVar(&destination, "dest", "options/license/", "destination for the licenses")
28
-}
29
-
30
-func main() {
31 28
 	flag.Parse()
32 29
 
33 30
 	file, err := ioutil.TempFile(os.TempDir(), prefix)
@@ -73,9 +70,6 @@ func main() {
73 70
 			log.Fatalf("Failed to iterate archive. %s", err)
74 71
 		}
75 72
 
76
-		fmt.Println(hdr.Name)
77
-		fmt.Println(filepath.Ext(hdr.Name))
78
-
79 73
 		if filepath.Ext(hdr.Name) != ".txt" {
80 74
 			continue
81 75
 		}
@@ -88,8 +82,6 @@ func main() {
88 82
 			continue
89 83
 		}
90 84
 
91
-		fmt.Println(path.Join(destination, strings.TrimSuffix(filepath.Base(hdr.Name), ".txt")))
92
-
93 85
 		out, err := os.Create(path.Join(destination, strings.TrimSuffix(filepath.Base(hdr.Name), ".txt")))
94 86
 
95 87
 		if err != nil {