Compare commits

..

No commits in common. "e310c168f4f1bf5e736088009df70d6f6295430a" and "27a1025eba139504a4d697a221785abec164bf80" have entirely different histories.

2 changed files with 6 additions and 25 deletions

View file

@ -1,5 +1,5 @@
VERS_MAJOR := 0
VERS_MINOR := 4
VERS_MINOR := 3
VERSION := $(VERS_MAJOR).$(VERS_MINOR)
NEW_MINOR := $$(( $(VERS_MINOR) + 1 ))
NEW_MAJOR := $$(( $(VERS_MAJOR) + 1 ))
@ -9,15 +9,7 @@ output:
output/sendmail: output
go build -o output/sendmail -ldflags "-X main.version=$(VERSION)" ./...
output/sendmail-dev: output
go build -o output/sendmail-dev ./...
clean:
rm output/*
build: clean output/sendmail
dev-build: clean output/sendmail-dev
build: output/sendmail
bumpvers-minor:
sed -i"" "s/VERS_MINOR := $(VERS_MINOR)/VERS_MINOR := $(NEW_MINOR)/" Makefile
@ -39,4 +31,4 @@ release-maj:
make bumpvers-major
make build
PHONY: bumpvers-minor bumpvers-major release-min release-maj clean
PHONY: bumpvers-minor bumpvers-major release-min release-maj

17
main.go
View file

@ -6,13 +6,12 @@ import (
"fmt"
"os"
"strings"
"time"
)
var noVersion = "dev"
var version string
func readFromConsole(result chan string) {
func readFromConsole() string {
var text, line string
var err error
counter := 0
@ -30,8 +29,7 @@ func readFromConsole(result chan string) {
Error.F("Error in reading text from console\n%s", err)
os.Exit(1)
}
result <- strings.TrimRight(text, "\n")
return
return strings.TrimRight(text, "\n")
}
func toList(input string) []string {
@ -102,16 +100,7 @@ func main() {
}
if flag.NArg() == 0 {
result := make(chan string, 1)
go readFromConsole(result)
select {
case text = <-result:
Info.Ln("text read from console")
case <-time.After(5 * time.Minute):
Error.Ln("timeout reading from console")
os.Exit(3)
}
text = readFromConsole()
} else {
for _, arg := range flag.Args() {
text += fmt.Sprintf("%s\n", arg)