ritscc / Snack

Snack - RCC Internal Messenger Application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Converterの関数名を公式と同じにする

1uf3 opened this issue · comments

commented
// authz2ModelMapToPB converts a mapping of domain name to authz2Models into a
// protobuf authorizations map
func authz2ModelMapToPB(m map[string]authz2Model) (*sapb.Authorizations, error) {
    resp := &sapb.Authorizations{}
    for k, v := range m {
        // Make a copy of k because it will be reassigned with each loop.
        kCopy := k
        authzPB, err := modelToAuthzPB(&v)
        if err != nil {
            return nil, err
        }
        resp.Authz = append(resp.Authz, &sapb.Authorizations_MapElement{
            Domain: &kCopy,
            Authz: authzPB,
        })
    }
    return resp, nil
}
commented

あ、上記のコードはforループを使ったバグコードです
使うときは修正してください