summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--argv.go3
-rw-r--r--argvAutocomplete.go3
-rw-r--r--doAptUpgrade.go3
-rw-r--r--doDebian.go3
-rw-r--r--doWITCOM.go39
-rw-r--r--main.go3
-rw-r--r--repomap.go3
-rw-r--r--structs.go3
-rw-r--r--windowApply.go3
10 files changed, 52 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index 90b8f6c..5aa6415 100644
--- a/Makefile
+++ b/Makefile
@@ -27,5 +27,8 @@ goimports:
clean:
rm -f go.*
+gpl:
+ wit-test --witcom
+
check-git-clean:
@git diff-index --quiet HEAD -- || (echo "Git repository is dirty, please commit your changes first"; exit 1)
diff --git a/argv.go b/argv.go
index cbf6693..464f755 100644
--- a/argv.go
+++ b/argv.go
@@ -1,3 +1,6 @@
+// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
+// Use of this source code is governed by the GPL 3.0
+
package main
/*
diff --git a/argvAutocomplete.go b/argvAutocomplete.go
index 7c000fc..9d60ceb 100644
--- a/argvAutocomplete.go
+++ b/argvAutocomplete.go
@@ -1,3 +1,6 @@
+// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
+// Use of this source code is governed by the GPL 3.0
+
package main
import (
diff --git a/doAptUpgrade.go b/doAptUpgrade.go
index 0245625..37b2ca9 100644
--- a/doAptUpgrade.go
+++ b/doAptUpgrade.go
@@ -1,3 +1,6 @@
+// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
+// Use of this source code is governed by the GPL 3.0
+
package main
import (
diff --git a/doDebian.go b/doDebian.go
index 2761eb7..7681bec 100644
--- a/doDebian.go
+++ b/doDebian.go
@@ -1,3 +1,6 @@
+// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
+// Use of this source code is governed by the GPL 3.0
+
package main
import (
diff --git a/doWITCOM.go b/doWITCOM.go
index 83b2662..085a332 100644
--- a/doWITCOM.go
+++ b/doWITCOM.go
@@ -1,3 +1,7 @@
+// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
+// Use of this source code is governed by the GPL 3.0
+
+
package main
import (
@@ -25,6 +29,7 @@ func doWITCOM() {
}
// add a common header for WIT files
+// add a common header for WIT files
func addCommonHeader(filename string) error {
// read in the .proto file
@@ -34,13 +39,7 @@ func addCommonHeader(filename string) error {
return err
}
- pf, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
- defer pf.Close()
- if err != nil {
- log.Info("file open error. permissions?", filename, err)
- return err
- }
-
+ var newfile string
var start bool = true
var found bool
var done bool
@@ -52,10 +51,10 @@ func addCommonHeader(filename string) error {
start = false
if strings.Contains(line, "WIT.COM") {
found = true
- continue
} else {
- fmt.Fprintln(pf, line)
+ newfile += fmt.Sprintln(line)
}
+ continue
}
// dump every other comment
@@ -64,16 +63,28 @@ func addCommonHeader(filename string) error {
} else {
found = false
}
+
+ // print the header once
if !done {
- fmt.Fprintln(pf, "// Copyright 2017-2025 WIT.COM Inc. All rights reserved.")
- fmt.Fprintln(pf, "// Use of this source code is governed by the GPL 3.0")
- fmt.Fprintln(pf, "")
- fmt.Fprintln(pf, line)
+ newfile += fmt.Sprintln("// Copyright 2017-2025 WIT.COM Inc. All rights reserved.")
+ newfile += fmt.Sprintln("// Use of this source code is governed by the GPL 3.0")
+ newfile += fmt.Sprintln("")
done = true
}
- fmt.Fprintln(pf, line)
+ newfile += fmt.Sprintln(line)
}
+ pf, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
+ if err != nil {
+ log.Info("file open error. permissions?", filename, err)
+ return err
+ }
+
+ // trim trailing empty lines from the new file
+ newfile = strings.TrimSpace(newfile)
+ fmt.Fprintln(pf, newfile)
+ pf.Close()
+
return nil
}
diff --git a/main.go b/main.go
index 430db25..91a3a50 100644
--- a/main.go
+++ b/main.go
@@ -1,3 +1,6 @@
+// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
+// Use of this source code is governed by the GPL 3.0
+
package main
import (
diff --git a/repomap.go b/repomap.go
index f41e637..6ab056a 100644
--- a/repomap.go
+++ b/repomap.go
@@ -1,3 +1,6 @@
+// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
+// Use of this source code is governed by the GPL 3.0
+
package main
import (
diff --git a/structs.go b/structs.go
index df8a3db..9307b0e 100644
--- a/structs.go
+++ b/structs.go
@@ -1,3 +1,6 @@
+// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
+// Use of this source code is governed by the GPL 3.0
+
package main
import (
diff --git a/windowApply.go b/windowApply.go
index 11bb4fa..5c85416 100644
--- a/windowApply.go
+++ b/windowApply.go
@@ -1,3 +1,6 @@
+// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
+// Use of this source code is governed by the GPL 3.0
+
package main
import (