add common GPL headers
This commit is contained in:
parent
899cbb3483
commit
22e0cbe022
3
Makefile
3
Makefile
|
@ -27,5 +27,8 @@ goimports:
|
||||||
clean:
|
clean:
|
||||||
rm -f go.*
|
rm -f go.*
|
||||||
|
|
||||||
|
gpl:
|
||||||
|
wit-test --witcom
|
||||||
|
|
||||||
check-git-clean:
|
check-git-clean:
|
||||||
@git diff-index --quiet HEAD -- || (echo "Git repository is dirty, please commit your changes first"; exit 1)
|
@git diff-index --quiet HEAD -- || (echo "Git repository is dirty, please commit your changes first"; exit 1)
|
||||||
|
|
3
argv.go
3
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
|
package main
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -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
|
package main
|
||||||
|
|
||||||
import (
|
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
|
package main
|
||||||
|
|
||||||
import (
|
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
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
39
doWITCOM.go
39
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
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -24,6 +28,7 @@ func doWITCOM() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add a common header for WIT files
|
||||||
// add a common header for WIT files
|
// add a common header for WIT files
|
||||||
|
|
||||||
func addCommonHeader(filename string) error {
|
func addCommonHeader(filename string) error {
|
||||||
|
@ -34,13 +39,7 @@ func addCommonHeader(filename string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
pf, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
|
var newfile string
|
||||||
defer pf.Close()
|
|
||||||
if err != nil {
|
|
||||||
log.Info("file open error. permissions?", filename, err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
var start bool = true
|
var start bool = true
|
||||||
var found bool
|
var found bool
|
||||||
var done bool
|
var done bool
|
||||||
|
@ -52,10 +51,10 @@ func addCommonHeader(filename string) error {
|
||||||
start = false
|
start = false
|
||||||
if strings.Contains(line, "WIT.COM") {
|
if strings.Contains(line, "WIT.COM") {
|
||||||
found = true
|
found = true
|
||||||
continue
|
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintln(pf, line)
|
newfile += fmt.Sprintln(line)
|
||||||
}
|
}
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// dump every other comment
|
// dump every other comment
|
||||||
|
@ -64,16 +63,28 @@ func addCommonHeader(filename string) error {
|
||||||
} else {
|
} else {
|
||||||
found = false
|
found = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// print the header once
|
||||||
if !done {
|
if !done {
|
||||||
fmt.Fprintln(pf, "// Copyright 2017-2025 WIT.COM Inc. All rights reserved.")
|
newfile += fmt.Sprintln("// Copyright 2017-2025 WIT.COM Inc. All rights reserved.")
|
||||||
fmt.Fprintln(pf, "// Use of this source code is governed by the GPL 3.0")
|
newfile += fmt.Sprintln("// Use of this source code is governed by the GPL 3.0")
|
||||||
fmt.Fprintln(pf, "")
|
newfile += fmt.Sprintln("")
|
||||||
fmt.Fprintln(pf, line)
|
|
||||||
done = true
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
3
main.go
3
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
|
package main
|
||||||
|
|
||||||
import (
|
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
|
package main
|
||||||
|
|
||||||
import (
|
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
|
package main
|
||||||
|
|
||||||
import (
|
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
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
Loading…
Reference in New Issue