pkg/plugins: format code with gofumpt
Formatting the code with https://github.com/mvdan/gofumpt Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
651086d1d9
commit
1216328c2d
5 changed files with 14 additions and 15 deletions
|
@ -43,10 +43,10 @@ func TestFileSpecPlugin(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, c := range cases {
|
||||
if err := os.MkdirAll(filepath.Dir(c.path), 0755); err != nil {
|
||||
if err := os.MkdirAll(filepath.Dir(c.path), 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.WriteFile(c.path, []byte(c.addr), 0644); err != nil {
|
||||
if err := os.WriteFile(c.path, []byte(c.addr), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ func TestFileJSONSpecPlugin(t *testing.T) {
|
|||
}
|
||||
}`
|
||||
|
||||
if err := os.WriteFile(p, []byte(spec), 0644); err != nil {
|
||||
if err := os.WriteFile(p, []byte(spec), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ func TestFileJSONSpecPluginWithoutTLSConfig(t *testing.T) {
|
|||
"Addr": "https://example.com/docker/plugin"
|
||||
}`
|
||||
|
||||
if err := os.WriteFile(p, []byte(spec), 0644); err != nil {
|
||||
if err := os.WriteFile(p, []byte(spec), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ func TestLocalSocket(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, c := range cases {
|
||||
if err := os.MkdirAll(filepath.Dir(c), 0755); err != nil {
|
||||
if err := os.MkdirAll(filepath.Dir(c), 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
@ -77,12 +77,12 @@ func TestScan(t *testing.T) {
|
|||
addr := "unix://var/lib/docker/plugins/echo.sock"
|
||||
name := "echo"
|
||||
|
||||
err = os.MkdirAll(filepath.Dir(path), 0755)
|
||||
err = os.MkdirAll(filepath.Dir(path), 0o755)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
err = os.WriteFile(path, []byte(addr), 0644)
|
||||
err = os.WriteFile(path, []byte(addr), 0o644)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ func TestScanNotPlugins(t *testing.T) {
|
|||
// `Scan()` uses to find plugins to the returned `tmpdir`
|
||||
|
||||
notPlugin := filepath.Join(tmpdir, "not-a-plugin")
|
||||
if err := os.MkdirAll(notPlugin, 0700); err != nil {
|
||||
if err := os.MkdirAll(notPlugin, 0o700); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ func TestGetAll(t *testing.T) {
|
|||
"Addr": "https://example.com/docker/plugin"
|
||||
}`
|
||||
|
||||
if err := os.WriteFile(p, []byte(spec), 0644); err != nil {
|
||||
if err := os.WriteFile(p, []byte(spec), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ func (s stringSet) Set(value string) error {
|
|||
s.values[value] = struct{}{}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s stringSet) GetValues() map[string]struct{} {
|
||||
return s.values
|
||||
}
|
||||
|
@ -67,7 +68,7 @@ func main() {
|
|||
pkg, err := Parse(*inputFile, *typeName)
|
||||
errorOut(fmt.Sprintf("error parsing requested type %s", *typeName), err)
|
||||
|
||||
var analysis = struct {
|
||||
analysis := struct {
|
||||
InterfaceType string
|
||||
RPCName string
|
||||
BuildTags map[string]struct{}
|
||||
|
@ -78,7 +79,7 @@ func main() {
|
|||
errorOut("parser error", generatedTempl.Execute(&buf, analysis))
|
||||
src, err := format.Source(buf.Bytes())
|
||||
errorOut("error formatting generated source:\n"+buf.String(), err)
|
||||
errorOut("error writing file", os.WriteFile(*outputFile, src, 0644))
|
||||
errorOut("error writing file", os.WriteFile(*outputFile, src, 0o644))
|
||||
}
|
||||
|
||||
func toLower(s string) string {
|
||||
|
|
|
@ -36,10 +36,8 @@ import (
|
|||
// ProtocolSchemeHTTPV1 is the name of the protocol used for interacting with plugins using this package.
|
||||
const ProtocolSchemeHTTPV1 = "moby.plugins.http/v1"
|
||||
|
||||
var (
|
||||
// ErrNotImplements is returned if the plugin does not implement the requested driver.
|
||||
ErrNotImplements = errors.New("Plugin does not implement the requested driver")
|
||||
)
|
||||
// ErrNotImplements is returned if the plugin does not implement the requested driver.
|
||||
var ErrNotImplements = errors.New("Plugin does not implement the requested driver")
|
||||
|
||||
type plugins struct {
|
||||
sync.Mutex
|
||||
|
|
Loading…
Add table
Reference in a new issue