From 780cb692d64edfadea6f79fbbad2ef033cdbe796 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Wed, 15 Mar 2017 16:11:26 +0100 Subject: [PATCH] Make sure both scripts/ can live side by side (#1264) --- scripts/generate-gitignores.go | 19 ++++++++----------- scripts/generate-licenses.go | 24 ++++++++---------------- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/scripts/generate-gitignores.go b/scripts/generate-gitignores.go index 471152c907..a169fc0242 100644 --- a/scripts/generate-gitignores.go +++ b/scripts/generate-gitignores.go @@ -1,4 +1,4 @@ -// +build !build +// +build ignore package main @@ -17,17 +17,14 @@ import ( "strings" ) -var ( - prefix = "gitea-gitignore" - url = "https://api.github.com/repos/github/gitignore/tarball" - destination = "" -) - -func init() { - flag.StringVar(&destination, "dest", "options/gitignore/", "destination for the gitignores") -} - func main() { + var ( + prefix = "gitea-gitignore" + url = "https://api.github.com/repos/github/gitignore/tarball" + destination = "" + ) + + flag.StringVar(&destination, "dest", "options/gitignore/", "destination for the gitignores") flag.Parse() file, err := ioutil.TempFile(os.TempDir(), prefix) diff --git a/scripts/generate-licenses.go b/scripts/generate-licenses.go index c99cdb3651..03287d1dc9 100644 --- a/scripts/generate-licenses.go +++ b/scripts/generate-licenses.go @@ -1,4 +1,4 @@ -// +build !build +// +build ignore package main @@ -17,17 +17,14 @@ import ( "strings" ) -var ( - prefix = "gitea-licenses" - url = "https://api.github.com/repos/spdx/license-list/tarball" - destination = "" -) - -func init() { - flag.StringVar(&destination, "dest", "options/license/", "destination for the licenses") -} - func main() { + var ( + prefix = "gitea-licenses" + url = "https://api.github.com/repos/spdx/license-list/tarball" + destination = "" + ) + + flag.StringVar(&destination, "dest", "options/license/", "destination for the licenses") flag.Parse() file, err := ioutil.TempFile(os.TempDir(), prefix) @@ -73,9 +70,6 @@ func main() { log.Fatalf("Failed to iterate archive. %s", err) } - fmt.Println(hdr.Name) - fmt.Println(filepath.Ext(hdr.Name)) - if filepath.Ext(hdr.Name) != ".txt" { continue } @@ -88,8 +82,6 @@ func main() { continue } - fmt.Println(path.Join(destination, strings.TrimSuffix(filepath.Base(hdr.Name), ".txt"))) - out, err := os.Create(path.Join(destination, strings.TrimSuffix(filepath.Base(hdr.Name), ".txt"))) if err != nil {