mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-06 05:17:49 +00:00
93a04158fd
gvt fetch -a, because we need the protobuf files etc for regeneration
26 lines
464 B
Go
26 lines
464 B
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"fmt"
|
|
"io/ioutil"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
args := os.Args
|
|
if len(args) != 4 {
|
|
fmt.Println("gogoreplace wants three arguments")
|
|
fmt.Println(" gogoreplace oldsubstring newsubstring filename")
|
|
os.Exit(1)
|
|
}
|
|
data, err := ioutil.ReadFile(args[3])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
data = bytes.Replace(data, []byte(args[1]), []byte(args[2]), -1)
|
|
if err := ioutil.WriteFile(args[3], data, 0666); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|