Merge pull request #1 from D4-project/modular

chg [lib] remove requirements, update isNet
d4forward 0.1.0
Jean-Louis Huynen 3 years ago committed by GitHub
commit 740f162401
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      config/config.go
  2. 7
      requirements.go

@ -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"))
}

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