github.com/jingcheng-WU/gonum@v0.9.1-0.20210323123734-f1a2a11a8f7b/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 // +build ignore 12 13 package main 14 15 import ( 16 "bytes" 17 "fmt" 18 "io/ioutil" 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 := ioutil.ReadFile(path) 46 if err != nil { 47 return err 48 } 49 50 content = bytes.Replace(content, location, copyright, 1) 51 return ioutil.WriteFile(path, content, info.Mode()) 52 }) 53 54 if err != nil { 55 fmt.Printf("error walking the path: %v\n", err) 56 } 57 }