Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Vault
Commits
d19aa41b
Commit
d19aa41b
authored
10 years ago
by
Seth Vargo
Browse files
Options
Download
Email Patches
Plain Diff
Use a pointer config instead
parent
c7843ed0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/api_test.go
+1
-1
api/api_test.go
api/client.go
+4
-4
api/client.go
with
5 additions
and
5 deletions
+5
-5
api/api_test.go
+
1
-
1
View file @
d19aa41b
...
...
@@ -10,7 +10,7 @@ import (
// testHTTPServer creates a test HTTP server that handles requests until
// the listener returned is closed.
func
testHTTPServer
(
t
*
testing
.
T
,
handler
http
.
Handler
)
(
Config
,
net
.
Listener
)
{
t
*
testing
.
T
,
handler
http
.
Handler
)
(
*
Config
,
net
.
Listener
)
{
ln
,
err
:=
net
.
Listen
(
"tcp"
,
"127.0.0.1:0"
)
if
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
...
...
This diff is collapsed.
Click to expand it.
api/client.go
+
4
-
4
View file @
d19aa41b
...
...
@@ -33,8 +33,8 @@ type Config struct {
// DefaultConfig returns a default configuration for the client. It is
// safe to modify the return value of this function.
func
DefaultConfig
()
Config
{
config
:=
Config
{
func
DefaultConfig
()
*
Config
{
config
:=
&
Config
{
Address
:
"https://127.0.0.1:8200"
,
HttpClient
:
&
http
.
Client
{},
}
...
...
@@ -46,11 +46,11 @@ func DefaultConfig() Config {
// NewClient.
type
Client
struct
{
addr
*
url
.
URL
config
Config
config
*
Config
}
// NewClient returns a new client for the given configuration.
func
NewClient
(
c
Config
)
(
*
Client
,
error
)
{
func
NewClient
(
c
*
Config
)
(
*
Client
,
error
)
{
u
,
err
:=
url
.
Parse
(
c
.
Address
)
if
err
!=
nil
{
return
nil
,
err
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help