Skip to content

Commit

Permalink
goimports and use sync map (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
tianxiaoliang authored Nov 30, 2020
1 parent 5b60384 commit 387922b
Show file tree
Hide file tree
Showing 34 changed files with 104 additions and 114 deletions.
2 changes: 1 addition & 1 deletion archaius.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package archaius
import (
"errors"
"fmt"
filesource "github.com/go-chassis/go-archaius/source/file"
"os"
"strings"

Expand All @@ -13,7 +14,6 @@ import (
"github.com/go-chassis/go-archaius/source"
"github.com/go-chassis/go-archaius/source/cli"
"github.com/go-chassis/go-archaius/source/env"
"github.com/go-chassis/go-archaius/source/file"
"github.com/go-chassis/go-archaius/source/mem"
"github.com/go-chassis/openlog"
)
Expand Down
9 changes: 5 additions & 4 deletions archaius_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ package archaius_test

import (
"fmt"
"github.com/go-chassis/go-archaius"
"github.com/go-chassis/go-archaius/event"
"github.com/go-chassis/openlog"
"github.com/stretchr/testify/assert"
"io"
"os"
"path/filepath"
"testing"

"github.com/go-chassis/go-archaius"
"github.com/go-chassis/go-archaius/event"
"github.com/go-chassis/openlog"
"github.com/stretchr/testify/assert"
)

type EListener struct{}
Expand Down
3 changes: 2 additions & 1 deletion cast/cast.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ package cast

import (
"fmt"
ca "github.com/spf13/cast"
"reflect"
"strconv"

ca "github.com/spf13/cast"
)

//const
Expand Down
3 changes: 2 additions & 1 deletion cast/cast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package cast

import (
"errors"
"github.com/stretchr/testify/assert"
"reflect"
"testing"

"github.com/stretchr/testify/assert"
)

func TestCast(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion event/event_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ package event

import (
"errors"
"github.com/go-chassis/openlog"
"regexp"
"strings"

"github.com/go-chassis/openlog"
)

//errors
Expand Down
3 changes: 2 additions & 1 deletion event/event_system_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package event_test

import (
"github.com/go-chassis/go-archaius/event"
"testing"

"github.com/go-chassis/go-archaius/event"
)

type EListener struct {
Expand Down
24 changes: 3 additions & 21 deletions event/tool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package event_test

import (
"fmt"
"testing"

"github.com/go-chassis/go-archaius/event"
"github.com/stretchr/testify/assert"
"testing"
)

func TestPopulateEvents(t *testing.T) {
Expand All @@ -24,24 +25,5 @@ func TestPopulateEvents(t *testing.T) {
for _, eve := range events {
fmt.Printf("%+v\n", eve)
}
assert.Equal(t, []*event.Event{
{
EventSource: "test",
EventType: event.Create,
Key: "k2",
Value: "v2",
},
{
EventSource: "test",
EventType: event.Update,
Key: "k3",
Value: "v3",
},
{
EventSource: "test",
EventType: event.Delete,
Key: "k4",
Value: "v4",
},
}, events)
assert.Equal(t, 3, len(events))
}
3 changes: 2 additions & 1 deletion examples/apollo/apollo.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package main

import (
"fmt"
"time"

agollo "github.com/Shonminh/apollo-client"
"github.com/go-chassis/go-archaius"
"github.com/go-chassis/go-archaius/event"
"github.com/go-chassis/go-archaius/source/apollo"
_ "github.com/go-chassis/go-archaius/source/apollo"
"github.com/go-chassis/openlog"
"time"
)

type Listener struct {
Expand Down
3 changes: 2 additions & 1 deletion examples/env/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package main

import (
"github.com/go-chassis/go-archaius"
"log"
"os"

"github.com/go-chassis/go-archaius"
)

func main() {
Expand Down
3 changes: 2 additions & 1 deletion examples/file/main.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package main

import (
"log"

"github.com/go-chassis/go-archaius"
"github.com/go-chassis/go-archaius/source/util"
"github.com/go-chassis/openlog"
"log"
)

func main() {
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
github.com/go-chassis/kie-client v0.0.0-20201125103729-ea0126f9110d
github.com/go-chassis/openlog v1.1.2
github.com/gorilla/websocket v1.4.0
github.com/mitchellh/mapstructure v1.3.3
github.com/spf13/cast v1.2.0
github.com/stretchr/testify v1.6.1
gopkg.in/yaml.v2 v2.2.4
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
Expand Down
1 change: 1 addition & 0 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package archaius

import (
"crypto/tls"

"github.com/go-chassis/go-archaius/source/util"
)

Expand Down
9 changes: 5 additions & 4 deletions pkg/configcenter/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ import (
"context"
"errors"
"fmt"
"github.com/go-chassis/foundation/httpclient"
"github.com/go-chassis/go-archaius/pkg/serializers"
"github.com/go-chassis/openlog"
"github.com/gorilla/websocket"
"io/ioutil"
"math/rand"
"net/http"
Expand All @@ -33,6 +29,11 @@ import (
"strings"
"sync"
"time"

"github.com/go-chassis/foundation/httpclient"
"github.com/go-chassis/go-archaius/pkg/serializers"
"github.com/go-chassis/openlog"
"github.com/gorilla/websocket"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion pkg/configcenter/client_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package configcenter_test

import (
"github.com/go-chassis/go-archaius/pkg/configcenter"
"testing"

"github.com/go-chassis/go-archaius/pkg/configcenter"
)

func TestNew(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/configcenter/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package configcenter_test

import (
"encoding/json"
"testing"

"github.com/go-chassis/go-archaius/pkg/configcenter"
"github.com/stretchr/testify/assert"
"testing"
)

func TestGetConfigs(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions pkg/serializers/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package serializers

import (
"errors"

"github.com/go-chassis/go-archaius/pkg/serializers/json"
)

Expand Down
3 changes: 2 additions & 1 deletion pkg/serializers/types_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package serializers

import (
"github.com/go-chassis/go-archaius/pkg/serializers/json"
"testing"

"github.com/go-chassis/go-archaius/pkg/serializers/json"
)

type Test struct {
Expand Down
3 changes: 2 additions & 1 deletion remote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
package archaius_test

import (
"testing"

"github.com/go-chassis/go-archaius"
"github.com/go-chassis/go-archaius/source/remote/configcenter"
"testing"
)

func TestInstallRemoteSource(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion source/apollo/apollo.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package apollo
import (
"errors"
"fmt"
"sync"

apollo "github.com/Shonminh/apollo-client"
"github.com/go-chassis/go-archaius"
"github.com/go-chassis/go-archaius/event"
"github.com/go-chassis/go-archaius/source"
"github.com/go-chassis/openlog"
"sync"
)

// Source apollo source
Expand Down
3 changes: 2 additions & 1 deletion source/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ package cli

import (
"fmt"
"github.com/go-chassis/go-archaius/event"
"os"
"testing"

"github.com/go-chassis/go-archaius/event"
)

type TestDynamicConfigHandler struct{}
Expand Down
10 changes: 6 additions & 4 deletions source/configmap/configmap_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,22 @@ package configmapource
import (
"errors"
"fmt"
"github.com/go-chassis/go-archaius/event"
"github.com/go-chassis/go-archaius/source"
"io/ioutil"
"math"
"os"
"path/filepath"
"reflect"
"sync"

"github.com/go-chassis/go-archaius/event"
"github.com/go-chassis/go-archaius/source"

"strings"
"time"

"github.com/fsnotify/fsnotify"
"github.com/go-chassis/go-archaius/source/util"
"github.com/go-chassis/openlog"
"strings"
"time"
)

const (
Expand Down
5 changes: 3 additions & 2 deletions source/configmap/configmap_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ package configmapource

import (
"fmt"
"github.com/go-chassis/go-archaius/event"
"github.com/stretchr/testify/assert"
"io"
"os"
"path/filepath"
"testing"
"time"

"github.com/go-chassis/go-archaius/event"
"github.com/stretchr/testify/assert"
)

type EListener struct {
Expand Down
3 changes: 2 additions & 1 deletion source/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
package env

import (
"github.com/go-chassis/go-archaius/source"
"os"
"strings"
"sync"

"github.com/go-chassis/go-archaius/source"

"github.com/go-chassis/openlog"
)

Expand Down
5 changes: 3 additions & 2 deletions source/env/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ package env_test

import (
"fmt"
"os"
"testing"

"github.com/go-chassis/go-archaius/event"
"github.com/go-chassis/go-archaius/source/env"
"github.com/stretchr/testify/assert"
"os"
"testing"
)

type TestDynamicConfigHandler struct{}
Expand Down
7 changes: 4 additions & 3 deletions source/file/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ package filesource_test

import (
"fmt"
"github.com/go-chassis/go-archaius/event"
filesource "github.com/go-chassis/go-archaius/source/file"
"github.com/stretchr/testify/assert"
"io"
"os"
"path/filepath"
"testing"
"time"

"github.com/go-chassis/go-archaius/event"
filesource "github.com/go-chassis/go-archaius/source/file"
"github.com/stretchr/testify/assert"
)

type TestDynamicConfigHandler struct {
Expand Down
Loading

0 comments on commit 387922b

Please sign in to comment.