gonum.org/v1/gonum@v0.14.0/graph/formats/dot/internal/paste_copyright.go (about) 1 // This file is dual licensed under CC0 and The Gonum License. 2 // 3 // Copyright ©2017 The Gonum Authors. All rights reserved. 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file. 6 // 7 // Copyright ©2017 Robin Eklind. 8 // This file is made available under a Creative Commons CC0 1.0 9 // Universal Public Domain Dedication.`) 10 11 //go:build ignore 12 // +build ignore 13 14 package main 15 16 import ( 17 "bytes" 18 "fmt" 19 "os" 20 "path/filepath" 21 ) 22 23 var location = []byte(`// Code generated by gocc; DO NOT EDIT.`) 24 var copyright = []byte(`// Code generated by gocc; DO NOT EDIT. 25 26 // This file is dual licensed under CC0 and The Gonum License. 27 // 28 // Copyright ©2017 The Gonum Authors. All rights reserved. 29 // Use of this source code is governed by a BSD-style 30 // license that can be found in the LICENSE file. 31 // 32 // Copyright ©2017 Robin Eklind. 33 // This file is made available under a Creative Commons CC0 1.0 34 // Universal Public Domain Dedication.`) 35 36 func main() { 37 err := filepath.Walk(".", func(path string, info os.FileInfo, err error) error { 38 if err != nil { 39 return err 40 } 41 if info.IsDir() || filepath.Dir(path) == "." || filepath.Ext(path) != ".go" { 42 return nil 43 } 44 45 content, err := os.ReadFile(path) 46 if err != nil { 47 return err 48 } 49 50 content = bytes.Replace(content, location, copyright, 1) 51 return os.WriteFile(path, content, info.Mode()) 52 }) 53 54 if err != nil { 55 fmt.Printf("error walking the path: %v\n", err) 56 } 57 }