mirror of
https://github.com/coredns/coredns.git
synced 2025-12-06 02:15:11 -05:00
just use setup (#1574)
All these functions are namespaced by their package anyway; just use setup().
This commit is contained in:
@@ -10,11 +10,11 @@ import (
|
||||
func init() {
|
||||
caddy.RegisterPlugin("whoami", caddy.Plugin{
|
||||
ServerType: "dns",
|
||||
Action: setupWhoami,
|
||||
Action: setup,
|
||||
})
|
||||
}
|
||||
|
||||
func setupWhoami(c *caddy.Controller) error {
|
||||
func setup(c *caddy.Controller) error {
|
||||
c.Next() // 'whoami'
|
||||
if c.NextArg() {
|
||||
return plugin.Error("whoami", c.ArgErr())
|
||||
|
||||
@@ -6,14 +6,14 @@ import (
|
||||
"github.com/mholt/caddy"
|
||||
)
|
||||
|
||||
func TestSetupWhoami(t *testing.T) {
|
||||
func TestSetup(t *testing.T) {
|
||||
c := caddy.NewTestController("dns", `whoami`)
|
||||
if err := setupWhoami(c); err != nil {
|
||||
if err := setup(c); err != nil {
|
||||
t.Fatalf("Expected no errors, but got: %v", err)
|
||||
}
|
||||
|
||||
c = caddy.NewTestController("dns", `whoami example.org`)
|
||||
if err := setupWhoami(c); err == nil {
|
||||
if err := setup(c); err == nil {
|
||||
t.Fatalf("Expected errors, but got: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user