Skip to content

Commit

Permalink
fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
xxjwxc committed May 6, 2020
1 parent 3009dfa commit 65ec418
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions profile/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type httpProfile struct {
}

var (
// DefaultAddress ...
DefaultAddress = ":6060"
)

Expand Down Expand Up @@ -60,6 +61,7 @@ func (h *httpProfile) String() string {
return "http"
}

// NewProfile ...
func NewProfile(opts ...profile.Option) profile.Profile {
mux := http.NewServeMux()

Expand Down
1 change: 1 addition & 0 deletions profile/pprof/pprof.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ func (p *profiler) String() string {
return "pprof"
}

// NewProfile new profile
func NewProfile(opts ...profile.Option) profile.Profile {
var options profile.Options
for _, o := range opts {
Expand Down
4 changes: 4 additions & 0 deletions profile/profile.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Package profile is for profilers
package profile

// Profile list
type Profile interface {
// Start the profiler
Start() error
Expand All @@ -11,6 +12,7 @@ type Profile interface {
}

var (
// DefaultProfile ...
DefaultProfile Profile = new(noop)
)

Expand All @@ -28,11 +30,13 @@ func (p *noop) String() string {
return "noop"
}

// Options opts define
type Options struct {
// Name to use for the profile
Name string
}

// Option opts list
type Option func(o *Options)

// Name of the profile
Expand Down
2 changes: 2 additions & 0 deletions registry/dns_naming_register.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ func (r *DNSNamingRegister) Deregister() error {
return nil
}

// Resolve resolve begin
func (r *DNSNamingRegister) Resolve(target string) (naming.Watcher, error) {
r.ctx, r.cancel = context.WithCancel(context.Background())
// w := &dnsNamingWatcher{
Expand Down Expand Up @@ -249,6 +250,7 @@ func (r *DNSNamingRegister) Init(opts ...Option) error {
return nil
}

// Options get opts list
func (r *DNSNamingRegister) Options() Options {
return r.opts
}
Expand Down
2 changes: 2 additions & 0 deletions registry/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"time"
)

// Options opts define
type Options struct {
Addrs []string
Timeout time.Duration
Expand All @@ -17,6 +18,7 @@ type Options struct {
Context context.Context
}

// Option opts list func
type Option func(*Options)

// type RegisterOptions struct {
Expand Down

0 comments on commit 65ec418

Please sign in to comment.