Merge pull request #1 from D4-project/modular
chg [lib] remove requirements, update isNetd4forward 0.1.0
commit
740f162401
|
@ -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…
Reference in New Issue