16683: Add checks related to sharing and remote users
[arvados.git] / lib / controller / federation / generate.go
index 1f37df858ccb008b4f3744264b00a9fb72817279..ab5d9966a4409479ec2bd1725e14a629c1770f12 100644 (file)
@@ -31,7 +31,7 @@ func main() {
        if err != nil {
                panic(err)
        }
-       orig := regexp.MustCompile(`(?ms)\nfunc [^\n]*CollectionList\(.*?\n}\n`).Find(buf)
+       orig := regexp.MustCompile(`(?ms)\nfunc [^\n]*generated_CollectionList\(.*?\n}\n`).Find(buf)
        if len(orig) == 0 {
                panic("can't find CollectionList func")
        }
@@ -49,18 +49,15 @@ func main() {
                panic(err)
        }
        go func() {
+               defer out.Close()
                out.Write(regexp.MustCompile(`(?ms)^.*package .*?import.*?\n\)\n`).Find(buf))
                io.WriteString(out, "//\n// -- this file is auto-generated -- do not edit -- edit list.go and run \"go generate\" instead --\n//\n\n")
-               for _, t := range []string{"Container", "Specimen"} {
+               for _, t := range []string{"Container", "Specimen", "User"} {
                        _, err := out.Write(bytes.ReplaceAll(orig, []byte("Collection"), []byte(t)))
                        if err != nil {
                                panic(err)
                        }
                }
-               err = out.Close()
-               if err != nil {
-                       panic(err)
-               }
        }()
        err = gofmt.Run()
        if err != nil {