mirror of
https://github.com/docker/docker-credential-helpers.git
synced 2026-06-13 16:01:28 +05:30
Merge pull request #273 from thaJeztah/gofumpt
format code with gofumpt
This commit is contained in:
@@ -37,7 +37,7 @@ func (m *memoryStore) Get(serverURL string) (string, string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *memoryStore) List() (map[string]string, error) {
|
func (m *memoryStore) List() (map[string]string, error) {
|
||||||
//Simply a placeholder to let memoryStore be a valid implementation of Helper interface
|
// Simply a placeholder to let memoryStore be a valid implementation of Helper interface
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,14 +235,14 @@ func TestEraseMissingServerURL(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestList(t *testing.T) {
|
func TestList(t *testing.T) {
|
||||||
//This tests that there is proper input an output into the byte stream
|
// This tests that there is proper input an output into the byte stream
|
||||||
//Individual stores are very OS specific and have been tested in osxkeychain and secretservice respectively
|
// Individual stores are very OS specific and have been tested in osxkeychain and secretservice respectively
|
||||||
out := new(bytes.Buffer)
|
out := new(bytes.Buffer)
|
||||||
h := newMemoryStore()
|
h := newMemoryStore()
|
||||||
if err := List(h, out); err != nil {
|
if err := List(h, out); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
//testing that there is an output
|
// testing that there is an output
|
||||||
if out.Len() == 0 {
|
if out.Len() == 0 {
|
||||||
t.Fatalf("expected output in the writer, got %d", 0)
|
t.Fatalf("expected output in the writer, got %d", 0)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ package osxkeychain
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|||||||
+6
-5
@@ -28,11 +28,12 @@ type Pass struct{}
|
|||||||
// Ideally these would be stored as members of Pass, but since all of Pass's
|
// Ideally these would be stored as members of Pass, but since all of Pass's
|
||||||
// methods have value receivers, not pointer receivers, and changing that is
|
// methods have value receivers, not pointer receivers, and changing that is
|
||||||
// backwards incompatible, we assume that all Pass instances share the same configuration
|
// backwards incompatible, we assume that all Pass instances share the same configuration
|
||||||
|
var (
|
||||||
// initializationMutex is held while initializing so that only one 'pass'
|
// initializationMutex is held while initializing so that only one 'pass'
|
||||||
// round-tripping is done to check pass is functioning.
|
// round-tripping is done to check pass is functioning.
|
||||||
var initializationMutex sync.Mutex
|
initializationMutex sync.Mutex
|
||||||
var passInitialized bool
|
passInitialized bool
|
||||||
|
)
|
||||||
|
|
||||||
// CheckInitialized checks whether the password helper can be used. It
|
// CheckInitialized checks whether the password helper can be used. It
|
||||||
// internally caches and so may be safely called multiple times with no impact
|
// internally caches and so may be safely called multiple times with no impact
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ package secretservice
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ func TestSecretServiceHelper(t *testing.T) {
|
|||||||
// remove them as they probably come from a previous failed test
|
// remove them as they probably come from a previous failed test
|
||||||
for k, v := range oldAuths {
|
for k, v := range oldAuths {
|
||||||
if strings.Compare(k, creds.ServerURL) == 0 && strings.Compare(v, creds.Username) == 0 {
|
if strings.Compare(k, creds.ServerURL) == 0 && strings.Compare(v, creds.Username) == 0 {
|
||||||
|
|
||||||
if err := helper.Delete(creds.ServerURL); err != nil {
|
if err := helper.Delete(creds.ServerURL); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,15 +111,15 @@ func exactMatch(serverURL, target url.URL) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func approximateMatch(serverURL, target url.URL) bool {
|
func approximateMatch(serverURL, target url.URL) bool {
|
||||||
//if scheme is missing assume it is the same as target
|
// if scheme is missing assume it is the same as target
|
||||||
if serverURL.Scheme == "" {
|
if serverURL.Scheme == "" {
|
||||||
serverURL.Scheme = target.Scheme
|
serverURL.Scheme = target.Scheme
|
||||||
}
|
}
|
||||||
//if port is missing assume it is the same as target
|
// if port is missing assume it is the same as target
|
||||||
if serverURL.Port() == "" && target.Port() != "" {
|
if serverURL.Port() == "" && target.Port() != "" {
|
||||||
serverURL.Host = serverURL.Host + ":" + target.Port()
|
serverURL.Host = serverURL.Host + ":" + target.Port()
|
||||||
}
|
}
|
||||||
//if path is missing assume it is the same as target
|
// if path is missing assume it is the same as target
|
||||||
if serverURL.Path == "" {
|
if serverURL.Path == "" {
|
||||||
serverURL.Path = target.Path
|
serverURL.Path = target.Path
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user