| 274 | } |
| 275 | |
| 276 | func maps(text []string, f *FileSet) (err error) { |
| 277 | for _, arg := range text[1:] { |
| 278 | arg = strings.ToLower(strings.TrimSpace(arg)) |
| 279 | switch { |
| 280 | case strings.HasPrefix(arg, "shim"): |
| 281 | arg = strings.TrimPrefix(arg, "shim") |
| 282 | if len(arg) == 0 { |
| 283 | f.AllowMapShims = true |
| 284 | continue |
| 285 | } |
| 286 | f.AllowMapShims, err = strconv.ParseBool(strings.TrimPrefix(arg, ":")) |
| 287 | if err != nil { |
| 288 | return fmt.Errorf("invalid shim directive; found %s, expected 'true' or 'false'", arg) |
| 289 | } |
| 290 | case strings.HasPrefix(arg, "binkeys"): |
| 291 | arg = strings.TrimPrefix(arg, "binkeys") |
| 292 | if len(arg) == 0 { |
| 293 | f.AllowBinMaps = true |
| 294 | continue |
| 295 | } |
| 296 | f.AllowBinMaps, err = strconv.ParseBool(strings.TrimPrefix(arg, ":")) |
| 297 | if err != nil { |
| 298 | return fmt.Errorf("invalid binkeys directive; found %s, expected 'true' or 'false'", arg) |
| 299 | } |
| 300 | case strings.HasPrefix(arg, "autoshim"): |
| 301 | arg = strings.TrimPrefix(arg, "autoshim") |
| 302 | if len(arg) == 0 { |
| 303 | f.AutoMapShims = true |
| 304 | continue |
| 305 | } |
| 306 | f.AutoMapShims, err = strconv.ParseBool(strings.TrimPrefix(arg, ":")) |
| 307 | if err != nil { |
| 308 | return fmt.Errorf("invalid autoshim directive; found %s, expected 'true' or 'false'", arg) |
| 309 | } |
| 310 | default: |
| 311 | if err != nil { |
| 312 | return fmt.Errorf("invalid autoshim directive; found %s, expected 'true' or 'false'", arg) |
| 313 | } |
| 314 | } |
| 315 | } |
| 316 | if f.AllowBinMaps && f.AutoMapShims { |
| 317 | warnf("both binkeys and autoshim are enabled; ignoring autoshim\n") |
| 318 | f.AutoMapShims = false |
| 319 | } |
| 320 | infof("shim:%t binkeys:%t autoshim:%t\n", f.AllowMapShims, f.AllowBinMaps, f.AutoMapShims) |
| 321 | return nil |
| 322 | } |
| 323 | |
| 324 | //msgp:timezone |
| 325 | func newtimezone(text []string, f *FileSet) error { |