diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-10-18 20:36:03 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-10-20 10:33:10 +0900 |
commit | 204eacc5c0503cecc796a74fd0c1948ad6a28051 (patch) | |
tree | aa9b9a87ccd6c6b22db35ff905ace687fa5d1a5a | |
parent | d1411bbec404a82cf5ccbc4632fba2c367c2b8de (diff) |
policy: name statement automatically when name is not given
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
-rw-r--r-- | table/policy.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/table/policy.go b/table/policy.go index 2b16ef65..5829fc98 100644 --- a/table/policy.go +++ b/table/policy.go @@ -2329,7 +2329,10 @@ func NewPolicy(c config.PolicyDefinition, dmap DefinedSetMap) (*Policy, error) { stmts := c.Statements.StatementList if len(stmts) != 0 { st = make([]*Statement, 0, len(stmts)) - for _, stmt := range stmts { + for idx, stmt := range stmts { + if stmt.Name == "" { + stmt.Name = fmt.Sprintf("%s_stmt%d", c.Name, idx) + } s, err := NewStatement(stmt, dmap) if err != nil { return nil, err |