2 Commits
0.2.2 ... 0.2.3

Author SHA1 Message Date
c76140ffe1 release: 0.2.3
- fixed file write for the '--inplace' option
2020-04-30 08:15:26 +03:00
a89e63f19f fix: file write for the '--inplace' option
removes tails for --inplace in case
the source file is larger than the modified one
2020-04-30 08:09:53 +03:00
2 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,5 @@
NAME=multini NAME=multini
VERSION=0.2.2 VERSION=0.2.3
GOCMD=go GOCMD=go
LDFLAGS:="$(LDFLAGS) -X 'main.Version=$(VERSION)'" LDFLAGS:="$(LDFLAGS) -X 'main.Version=$(VERSION)'"
GOBUILD=$(GOCMD) build -ldflags=$(LDFLAGS) GOBUILD=$(GOCMD) build -ldflags=$(LDFLAGS)

View File

@ -114,7 +114,7 @@ func iniWriteInplace(filename string, ini *types.Ini) error {
} }
mode = info.Mode() mode = info.Mode()
} }
targetFile, err := os.OpenFile(realfilename, os.O_WRONLY|os.O_CREATE, mode) targetFile, err := os.OpenFile(realfilename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, mode)
if err == nil { if err == nil {
datawriter := bufio.NewWriter(targetFile) datawriter := bufio.NewWriter(targetFile)
_, err = datawriter.WriteString(ini.Full()) _, err = datawriter.WriteString(ini.Full())