Skip to content

Commit

Permalink
refactor(all): modify gomod name
Browse files Browse the repository at this point in the history
  • Loading branch information
overtalk committed Feb 19, 2020
1 parent 11ee918 commit 3f885d8
Show file tree
Hide file tree
Showing 14 changed files with 70 additions and 15 deletions.
55 changes: 55 additions & 0 deletions example/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package main

import (
"fmt"
"io/ioutil"
"os"

"github.com/overtalk/helmsman"
fileSource "github.com/overtalk/helmsman/source/file"
)

const str = `{
"A": "this is the test of a ",
"B": "this is the test of bbb"
}`

type ConfigDemo struct {
A string `json:"A"`
B string `json:"B"`
}

func GetConfig(path string) (*ConfigDemo, error) {
c := &ConfigDemo{}
fc := fileSource.NewFileConfig(path)
if err := fc.ParseConfig(config.JsonFormat, c); err != nil {
return nil, err
}

return c, nil
}

func main() {
// write config data to tmp file
tmpFile, err := ioutil.TempFile("", "temp_file")
if err != nil {
fmt.Println(err)
return
}
defer os.Remove(tmpFile.Name()) // clean up

// write data to the temp file
if err := ioutil.WriteFile(tmpFile.Name(), []byte(str), 0777); err != nil {
fmt.Println(err)
return
}

c, err := GetConfig(tmpFile.Name())
if err != nil {
fmt.Println(err)
return
}

fmt.Println(c.A)
fmt.Println(c.B)
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module helmsman
module github.com/overtalk/helmsman

go 1.13

Expand Down
4 changes: 2 additions & 2 deletions parser.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package config

import (
jsonParser "helmsman/parser/json"
ymlParser "helmsman/parser/yml"
jsonParser "github.com/overtalk/helmsman/parser/json"
ymlParser "github.com/overtalk/helmsman/parser/yml"
)

type ParserType string
Expand Down
2 changes: 1 addition & 1 deletion parser/json/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package parser_test
import (
"testing"

. "helmsman/parser/json"
. "github.com/overtalk/helmsman/parser/json"
)

const str = `{
Expand Down
2 changes: 1 addition & 1 deletion parser/toml/toml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package parser_test
import (
"testing"

. "helmsman/parser/toml"
. "github.com/overtalk/helmsman/parser/toml"
)

const str = `
Expand Down
2 changes: 1 addition & 1 deletion parser/xml/xml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/xml"
"testing"

. "helmsman/parser/xml"
. "github.com/overtalk/helmsman/parser/xml"
)

const str = `<?xml version="1.0" encoding="utf-8" standalone="yes"?>
Expand Down
2 changes: 1 addition & 1 deletion parser/yml/yml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package parser_test
import (
"testing"

. "helmsman/parser/yml"
. "github.com/overtalk/helmsman/parser/yml"
)

const str = `LogLevel: debug
Expand Down
2 changes: 1 addition & 1 deletion source/aliyun-oss/client.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package aliyun_oss

import (
"helmsman"
"github.com/overtalk/helmsman"
"errors"

"github.com/aliyun/aliyun-oss-go-sdk/oss"
Expand Down
2 changes: 1 addition & 1 deletion source/consul/consul_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package consul_test
//import (
// "testing"
//
// . "helmsman/source/consul"
// . "github.com/overtalk/helmsman/source/consul"
//)
//
//type Config struct {
Expand Down
2 changes: 1 addition & 1 deletion source/env/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"os"
"testing"

. "helmsman/source/env"
. "github.com/overtalk/helmsman/source/env"
)

type ConfigDemo struct {
Expand Down
2 changes: 1 addition & 1 deletion source/file/file.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package source

import (
"helmsman"
"github.com/overtalk/helmsman"
"io/ioutil"
"os"
)
Expand Down
4 changes: 2 additions & 2 deletions source/file/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"os"
"testing"

"helmsman"
. "helmsman/source/file"
"github.com/overtalk/helmsman"
. "github.com/overtalk/helmsman/source/file"
)

const str = `{
Expand Down
2 changes: 1 addition & 1 deletion source/github/client.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package github

import (
"helmsman"
"github.com/overtalk/helmsman"
"context"
"errors"

Expand Down
2 changes: 1 addition & 1 deletion source/gitlab/client.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package source

import (
"helmsman"
"github.com/overtalk/helmsman"
"errors"

"github.com/xanzy/go-gitlab"
Expand Down

0 comments on commit 3f885d8

Please sign in to comment.