Compare commits

...

2 Commits

Author SHA1 Message Date
73278439b0
fix hooks 2022-01-29 13:31:31 +01:00
0a589a2565
add test 2022-01-29 13:29:09 +01:00
4 changed files with 43 additions and 1 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
tests/buildenv/*
tests/bin/*

View File

@ -1,3 +1,6 @@
#!/usr/bin/env bash
go fmt *.go
git add *.go
go fmt tests/*.go
git add *.go tests/*.go
git add tests/*.go

22
tests/build.sh Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
dir=$(dirname $(realpath $0))
export GO111MODULE=on
export GOPROXY=direct
export GOPATH=${dir}/buildenv/deps
mkdir -p ${dir}/buildenv
chmod -R 755 ${dir}/buildenv
rm -rf ${dir}/buildenv
mkdir -p "${dir}/buildenv/src"
mkdir -p ${GOPATH}/src
mkdir -p ${dir}/bin
cp -r "${dir}/main.go" "${dir}/buildenv/src/main.go"
cd ${dir}/buildenv
go mod init src
go mod tidy
go build -o "${dir}/bin/test" "src/main.go"

15
tests/main.go Normal file
View File

@ -0,0 +1,15 @@
package main
import (
"fmt"
"git.purser.it/roypur/envconf"
)
func main() {
conf := envconf.NewConfig()
conf.Define("this_is_a_map", envconf.FixedHex(22))
conf.Parse()
conf.Status()
fmt.Println(conf.GetHex("this_is_a_map"))
}