Merge pull request #1 from D4-project/modular

chg [lib] remove requirements, update isNet
d4forward 0.1.0
Jean-Louis Huynen 2020-01-08 16:05:48 +01:00 committed by GitHub
commit 740f162401
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 13 deletions

View File

@ -73,7 +73,7 @@ func validPort(port string) bool {
}
// ReadConfigFile takes two argument: folder and fileName.
// It reads its content, trims\n, and return []byte
// It reads its content, trims\n and \r, and return []byte
// All errors are Fatal.
func ReadConfigFile(folder string, fileName string) []byte {
f, err := os.OpenFile("./"+folder+"/"+fileName, os.O_RDWR|os.O_CREATE, 0666)
@ -88,12 +88,11 @@ func ReadConfigFile(folder string, fileName string) []byte {
log.Fatal(err)
}
}
if count == 0 {
log.Fatal(fileName + " is empty.")
}
if err := f.Close(); err != nil {
log.Fatal(err)
}
// trim \n if present
return bytes.TrimSuffix(data[:count], []byte("\n"))
// trim \r and \n if present
r := bytes.TrimSuffix(data[:count], []byte("\n"))
return bytes.TrimSuffix(r, []byte("\r"))
}

View File

@ -1,7 +0,0 @@
package main
import (
_ "github.com/gofrs/uuid"
)
func main() {}