commit 3601ccf4f545178f1f5e862e61cd96030cefddc0 Author: 李光春 Date: Thu May 26 17:51:56 2022 +0800 - init diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..c56c479 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,17 @@ +kind: pipeline +type: docker +name: clone + +steps: + - name: Test + image: golang:1.18 + commands: + - go env -w GO111MODULE=on + - go env -w GOPROXY=https://goproxy.cn,direct + - go test -v ./... + - name: Benchmark + image: golang:1.18 + commands: + - go env -w GO111MODULE=on + - go env -w GOPROXY=https://goproxy.cn,direct + - go test -bench=. -benchmem \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4794692 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +.env +.git +.svn +.idea +.vscode +*.log +goinit.sh +gomod.sh +/vendor/ \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..647a0e4 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module go.dtapp.net/goint + +go 1.18 diff --git a/goint.go b/goint.go new file mode 100644 index 0000000..2cc1f29 --- /dev/null +++ b/goint.go @@ -0,0 +1,16 @@ +package goint + +import ( + "math" + "strconv" +) + +// ToString int到string +func ToString(n int) string { + return strconv.Itoa(n) +} + +// ToFloat64 int到float64 +func ToFloat64(n int) float64 { + return float64(n) / math.Pow10(0) +} diff --git a/goint_test.go b/goint_test.go new file mode 100644 index 0000000..7c93ce0 --- /dev/null +++ b/goint_test.go @@ -0,0 +1,13 @@ +package goint + +import ( + "testing" +) + +func TestToString(t *testing.T) { + t.Log(ToString(9898)) +} + +func TestToFloat64(t *testing.T) { + t.Log(ToFloat64(9898)) +} diff --git a/version.go b/version.go new file mode 100644 index 0000000..83d35c6 --- /dev/null +++ b/version.go @@ -0,0 +1,3 @@ +package goint + +const Version = "1.0.0" diff --git a/version_test.go b/version_test.go new file mode 100644 index 0000000..afc5ca5 --- /dev/null +++ b/version_test.go @@ -0,0 +1,7 @@ +package goint + +import "testing" + +func TestVersion(t *testing.T) { + t.Log(Version) +}