github.com/joelanford/operator-sdk@v0.8.2/internal/pkg/scaffold/ansible/go_mod.go (about) 1 // Copyright 2019 The Operator-SDK Authors 2 // 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 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package ansible 16 17 import ( 18 "fmt" 19 20 "github.com/operator-framework/operator-sdk/internal/pkg/scaffold/input" 21 "github.com/operator-framework/operator-sdk/internal/pkg/scaffold/internal/deps" 22 ) 23 24 const GoModFile = "go.mod" 25 26 // GoMod - the go.mod file for an Ansible hybrid operator. 27 type GoMod struct { 28 input.Input 29 } 30 31 func (s *GoMod) GetInput() (input.Input, error) { 32 if s.Path == "" { 33 s.Path = GoModFile 34 } 35 s.TemplateBody = goModTmpl 36 return s.Input, nil 37 } 38 39 const goModTmpl = `module {{ .Repo }} 40 41 require ( 42 cloud.google.com/go v0.37.2 // indirect 43 contrib.go.opencensus.io/exporter/ocagent v0.4.9 // indirect 44 github.com/Azure/go-autorest v11.7.0+incompatible // indirect 45 github.com/appscode/jsonpatch v0.0.0-20190108182946-7c0e3b262f30 // indirect 46 github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect 47 github.com/emicklei/go-restful v2.9.3+incompatible // indirect 48 github.com/go-logr/logr v0.1.0 // indirect 49 github.com/go-logr/zapr v0.1.1 // indirect 50 github.com/go-openapi/spec v0.19.0 // indirect 51 github.com/gogo/protobuf v1.2.1 // indirect 52 github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef // indirect 53 github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf // indirect 54 github.com/google/uuid v1.1.1 // indirect 55 github.com/googleapis/gnostic v0.2.0 // indirect 56 github.com/gophercloud/gophercloud v0.0.0-20190328150603-33e54f40ffcf // indirect 57 github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc // indirect 58 github.com/grpc-ecosystem/grpc-gateway v1.8.5 // indirect 59 github.com/hashicorp/golang-lru v0.5.1 // indirect 60 github.com/imdario/mergo v0.3.7 // indirect 61 github.com/json-iterator/go v1.1.6 // indirect 62 github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect 63 github.com/markbates/inflect v1.0.4 // indirect 64 github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect 65 github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 // indirect 66 github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect 67 github.com/operator-framework/operator-sdk v0.8.x 68 github.com/pborman/uuid v0.0.0-20180906182336-adf5a7427709 // indirect 69 github.com/peterbourgon/diskv v2.0.1+incompatible // indirect 70 github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 // indirect 71 github.com/prometheus/procfs v0.0.0-20190328153300-af7bedc223fb // indirect 72 github.com/sirupsen/logrus v1.4.0 // indirect 73 github.com/spf13/afero v1.2.2 // indirect 74 github.com/spf13/pflag v1.0.3 75 go.uber.org/atomic v1.3.2 // indirect 76 go.uber.org/multierr v1.1.0 // indirect 77 go.uber.org/zap v1.9.1 // indirect 78 golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c // indirect 79 golang.org/x/net v0.0.0-20190327214358-63eda1eb0650 // indirect 80 golang.org/x/oauth2 v0.0.0-20190319182350-c85d3e98c914 // indirect 81 golang.org/x/sys v0.0.0-20190322080309-f49334f85ddc // indirect 82 golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect 83 google.golang.org/appengine v1.5.0 // indirect 84 google.golang.org/genproto v0.0.0-20190327125643-d831d65fe17d // indirect 85 k8s.io/api v0.0.0-20181213150558-05914d821849 // indirect 86 k8s.io/apiextensions-apiserver v0.0.0-20190328030136-8ada4fd07db4 87 k8s.io/apimachinery v0.0.0-20181127025237-2b1284ed4c93 // indirect 88 k8s.io/client-go v0.0.0-20181213151034-8d9ed539ba31 89 k8s.io/code-generator v0.0.0-20190405172246-9a4d48088f6a 90 k8s.io/gengo v0.0.0-20190327210449-e17681d19d3a 91 k8s.io/klog v0.2.0 // indirect 92 k8s.io/kube-openapi v0.0.0-20190320154901-5e45bb682580 93 k8s.io/kubernetes v1.14.1 // indirect 94 sigs.k8s.io/controller-runtime v0.1.10 95 sigs.k8s.io/controller-tools v0.1.10 96 sigs.k8s.io/testing_frameworks v0.1.1 // indirect 97 sigs.k8s.io/yaml v1.1.0 // indirect 98 ) 99 100 // Pinned to kubernetes-1.13.1 101 replace ( 102 k8s.io/api => k8s.io/api v0.0.0-20181213150558-05914d821849 103 k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20181127025237-2b1284ed4c93 104 k8s.io/client-go => k8s.io/client-go v0.0.0-20181213151034-8d9ed539ba31 105 k8s.io/kubernetes => k8s.io/kubernetes v1.13.1 106 ) 107 108 replace ( 109 github.com/coreos/prometheus-operator => github.com/coreos/prometheus-operator v0.29.0 110 k8s.io/code-generator => k8s.io/code-generator v0.0.0-20181117043124-c2090bec4d9b 111 k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20180711000925-0cf8f7e6ed1d 112 ) 113 114 replace github.com/operator-framework/operator-sdk => github.com/operator-framework/operator-sdk v0.8.2 115 ` 116 117 func PrintGoMod(asFile bool) error { 118 b, err := deps.ExecGoModTmpl(goModTmpl) 119 if err != nil { 120 return err 121 } 122 if asFile { 123 fmt.Print(string(b)) 124 return nil 125 } 126 return deps.PrintGoMod(b) 127 }