diff options
| -rw-r--r-- | Makefile | 3 | ||||
| -rw-r--r-- | argv.go | 3 | ||||
| -rw-r--r-- | argvAutocomplete.go | 3 | ||||
| -rw-r--r-- | doAptUpgrade.go | 3 | ||||
| -rw-r--r-- | doDebian.go | 3 | ||||
| -rw-r--r-- | doWITCOM.go | 39 | ||||
| -rw-r--r-- | main.go | 3 | ||||
| -rw-r--r-- | repomap.go | 3 | ||||
| -rw-r--r-- | structs.go | 3 | ||||
| -rw-r--r-- | windowApply.go | 3 |
10 files changed, 52 insertions, 14 deletions
@@ -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) @@ -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 } @@ -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 ( @@ -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 ( @@ -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 ( |
