add common GPL headers
This commit is contained in:
parent
899cbb3483
commit
22e0cbe022
Notes:
Jeff Carr
2025-02-09 15:17:33 -06:00
// `autogen:go.mod` module go.wit.com/apps/utils/wit-test go 1.22 toolchain go1.23.4 require ( go.wit.com/dev/alexflint/arg v1.5.5 go.wit.com/gui v0.22.25 go.wit.com/lib/debugger v0.22.8 go.wit.com/lib/gadgets v0.22.8 go.wit.com/lib/gui/logsettings v0.22.8 go.wit.com/lib/gui/shell v0.22.24 go.wit.com/lib/protobuf/forgepb v0.0.74 go.wit.com/lib/protobuf/gitpb v0.0.74 go.wit.com/log v0.22.11 ) require ( github.com/destel/rill v0.7.0 // indirect github.com/go-cmd/cmd v1.4.3 // indirect github.com/google/uuid v1.6.0 // indirect go.wit.com/dev/alexflint/scalar v1.2.4 // indirect go.wit.com/lib/protobuf/zoopb v0.0.24 // indirect go.wit.com/widget v1.1.28 // indirect google.golang.org/protobuf v1.36.5 // indirect ) // `autogen:go.sum` github.com/destel/rill v0.7.0 h1:LJUbeMACaO+/e8rUNk940kYVESD/dbrhAp6M14IjQ0c= github.com/destel/rill v0.7.0/go.mod h1:srKuXzvGqINUEGYR5b/iwvW+L9/S35RxVHWGYbXNoO4= github.com/go-cmd/cmd v1.4.3 h1:6y3G+3UqPerXvPcXvj+5QNPHT02BUw7p6PsqRxLNA7Y= github.com/go-cmd/cmd v1.4.3/go.mod h1:u3hxg/ry+D5kwh8WvUkHLAMe2zQCaXd00t35WfQaOFk= github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg= github.com/go-test/deep v1.1.0/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= go.wit.com/dev/alexflint/arg v1.5.5 h1:c4jgIb4OvHjnCMRNSjOa1sNLl6WDxV6tIkMVezR9hCk= go.wit.com/dev/alexflint/arg v1.5.5/go.mod h1:nH3F6TJDaAUgnLkC0WgRN/H047YfN1TYKaWPYr6B8lo= go.wit.com/dev/alexflint/scalar v1.2.4 h1:zmBeEkObwz1lcelwfGNYP2GS6SQ9e0tdv7JdHwMZEEk= go.wit.com/dev/alexflint/scalar v1.2.4/go.mod h1:kCNO1Fo5LnnK6+qa+zYhP5fdgfC1C+vx1ti99Md+FAM= go.wit.com/gui v0.22.25 h1:qncgoJtb4F5uPI/7SpmbqRB7I78pN5OziWmiSQr2TUE= go.wit.com/gui v0.22.25/go.mod h1:BPGaYNWRAvVGN+LwKtRUHwbhXyGRTOF0u7S5OMtwomA= go.wit.com/lib/debugger v0.22.8 h1:fDp+EbTTF/OrOIxUR6zbKTZ1nlaCPqs0POMXyQvBWtw= go.wit.com/lib/debugger v0.22.8/go.mod h1:bmDwtI4UKsqP9gprmXMMivv9UMeMPAyB+1VvEmcqM8U= go.wit.com/lib/gadgets v0.22.8 h1:oPR8/6y8nIv7lepuTgas7BJ2GzyZjDKAhSDS2ORxZRQ= go.wit.com/lib/gadgets v0.22.8/go.mod h1:lQNvWP5RNV9+qHLWStN/I9LfCDq9ZlH1IOKuuxPhoQA= go.wit.com/lib/gui/logsettings v0.22.8 h1:Q5ZkOfTo70f+/616F4ZGkytMXJVqnQtMa2bR48Ijqss= go.wit.com/lib/gui/logsettings v0.22.8/go.mod h1:1jLA82nIL05bRPG4Ng2oVm3xw2/Gv1JEgwKR3J1cEQs= go.wit.com/lib/gui/shell v0.22.24 h1:zfwOAOuTggaeHboaoH+pi5jn7rdXGqHgrRtHVbdFNRA= go.wit.com/lib/gui/shell v0.22.24/go.mod h1:/9FxkZ4KrpocGNOuig3+LyQHdjeobQ5NDBRo+WojZ6w= go.wit.com/lib/protobuf/forgepb v0.0.74 h1:ByrA7c9u3CaWEaAvDI6gx2nesRcGjxWIZWwlYzpJMT0= go.wit.com/lib/protobuf/forgepb v0.0.74/go.mod h1:bCJYrrqbjNHl2SAF4iUPsnj7B6LDIMHkmw2HjO8seHs= go.wit.com/lib/protobuf/gitpb v0.0.74 h1:Lj4ngu9PPQDaE4GX+H4DnJ1fR5+y5t8hnbYZHicgO/o= go.wit.com/lib/protobuf/gitpb v0.0.74/go.mod h1:OX8C4NJS/vHbbIU+oKHUwibGKKPJNqMYiWkYW/LxHEU= go.wit.com/lib/protobuf/zoopb v0.0.24 h1:lMQB5Tuuel5aFRUndh3eUPdljc9LE5MnFsERF3pST8A= go.wit.com/lib/protobuf/zoopb v0.0.24/go.mod h1:N0lOOVRrlOocrk+Basi8kJjg31Qlu55hqq0gEMLweLE= go.wit.com/log v0.22.11 h1:BiJe+S81kWrMqW1QyZVu1Es2d//WG9FAcZQEhZkkM4c= go.wit.com/log v0.22.11/go.mod h1:LsP0nAH4hZEf2qj/F5UmGQT0OEJ3Q5698/P8ZOI2JuE= go.wit.com/widget v1.1.28 h1:xBrJBJ/5qGXTRE2uyOEcCV+6xAq8+3kBgqsJc1kqkiM= go.wit.com/widget v1.1.28/go.mod h1:9P1d7NRtyFwEkMS3ccpTEyRqZaFnScbWvE4MB5ooeZI= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM= google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= // `autogen:`
3
Makefile
3
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)
|
||||
|
|
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
|
||||
|
||||
/*
|
||||
|
|
|
@ -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 (
|
||||
|
|
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
|
||||
|
||||
import (
|
||||
|
@ -24,6 +28,7 @@ func doWITCOM() {
|
|||
}
|
||||
}
|
||||
|
||||
// add a common header for WIT files
|
||||
// add a common header for WIT files
|
||||
|
||||
func addCommonHeader(filename string) error {
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
|
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
|
||||
|
||||
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 (
|
||||
|
|
|
@ -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 (
|
||||
|
|
Loading…
Reference in New Issue