Commit c788649a authored by Yong Tang's avatar Yong Tang Committed by corbot[bot]

Replace bool map with struct{} map in chaos plugin (#2384)

Automatically submitted.
parent 95546dfd
...@@ -16,7 +16,7 @@ import ( ...@@ -16,7 +16,7 @@ import (
type Chaos struct { type Chaos struct {
Next plugin.Handler Next plugin.Handler
Version string Version string
Authors map[string]bool Authors map[string]struct{}
} }
// ServeDNS implements the plugin.Handler interface. // ServeDNS implements the plugin.Handler interface.
......
...@@ -14,7 +14,7 @@ import ( ...@@ -14,7 +14,7 @@ import (
func TestChaos(t *testing.T) { func TestChaos(t *testing.T) {
em := Chaos{ em := Chaos{
Version: version, Version: version,
Authors: map[string]bool{"Miek Gieben": true}, Authors: map[string]struct{}{"Miek Gieben": struct{}{}},
} }
tests := []struct { tests := []struct {
......
...@@ -28,12 +28,12 @@ func setup(c *caddy.Controller) error { ...@@ -28,12 +28,12 @@ func setup(c *caddy.Controller) error {
return nil return nil
} }
func chaosParse(c *caddy.Controller) (string, map[string]bool, error) { func chaosParse(c *caddy.Controller) (string, map[string]struct{}, error) {
// Set here so we pick up AppName and AppVersion that get set in coremain's init(). // Set here so we pick up AppName and AppVersion that get set in coremain's init().
chaosVersion = caddy.AppName + "-" + caddy.AppVersion chaosVersion = caddy.AppName + "-" + caddy.AppVersion
version := "" version := ""
authors := make(map[string]bool) authors := make(map[string]struct{})
for c.Next() { for c.Next() {
args := c.RemainingArgs() args := c.RemainingArgs()
...@@ -45,7 +45,7 @@ func chaosParse(c *caddy.Controller) (string, map[string]bool, error) { ...@@ -45,7 +45,7 @@ func chaosParse(c *caddy.Controller) (string, map[string]bool, error) {
} }
version = args[0] version = args[0]
for _, a := range args[1:] { for _, a := range args[1:] {
authors[a] = true authors[a] = struct{}{}
} }
return version, authors, nil return version, authors, nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment