main.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. Copyright 2015 The Kubernetes Authors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. // set-gen is an example usage of go2idl.
  14. //
  15. // Structs in the input directories with the below line in their comments will
  16. // have sets generated for them.
  17. // // +genset
  18. //
  19. // Any builtin type referenced anywhere in the input directories will have a
  20. // set generated for it.
  21. package main
  22. import (
  23. "os"
  24. "k8s.io/kubernetes/cmd/libs/go2idl/args"
  25. "k8s.io/kubernetes/cmd/libs/go2idl/set-gen/generators"
  26. "github.com/golang/glog"
  27. )
  28. func main() {
  29. arguments := args.Default()
  30. // Override defaults. These are Kubernetes specific input and output
  31. // locations.
  32. arguments.InputDirs = []string{"k8s.io/kubernetes/pkg/util/sets/types"}
  33. arguments.OutputPackagePath = "k8s.io/kubernetes/pkg/util/sets"
  34. if err := arguments.Execute(
  35. generators.NameSystems(),
  36. generators.DefaultNameSystem(),
  37. generators.Packages,
  38. ); err != nil {
  39. glog.Errorf("Error: %v", err)
  40. os.Exit(1)
  41. }
  42. glog.V(2).Info("Completed successfully.")
  43. }