Type "VaultManager" has both value and pointer receivers
75 return nil
76}
77
78func (manager *VaultManager) MarshalJSON() ([]byte, error) { 79 health, err := manager.Health()
80 if err != nil {
81 return nil, err
Type "VaultManager" has both value and pointer receivers
98 })
99}
100
101func (manager *VaultManager) Config(config map[string]interface{}) error {102 // apply defaults
103 manager.PathPrefix = "/concourse"
104 manager.PathPrefixes = []string{}
Type "VaultManager" has both value and pointer receivers
134 return nil
135}
136
137func (manager VaultManager) IsConfigured() bool {138 return manager.URL != ""
139}
140
Type "VaultManager" has both value and pointer receivers
138 return manager.URL != ""
139}
140
141func (manager VaultManager) Validate() error {142 _, err := url.Parse(manager.URL)
143 if err != nil {
144 return fmt.Errorf("invalid URL: %s", err)
Type "VaultManager" has both value and pointer receivers
172 return errors.New("must configure client token or auth backend")
173}
174
175func (manager VaultManager) Health() (*creds.HealthResponse, error) {176 health := &creds.HealthResponse{
177 Method: "/v1/sys/health",
178 }
Type "VaultManager" has both value and pointer receivers
187 return health, nil
188}
189
190func (manager *VaultManager) NewSecretsFactory(logger lager.Logger) (creds.SecretsFactory, error) {191 if manager.SecretFactory == nil {
192
193 templates := []*creds.SecretTemplate{}
Type "VaultManager" has both value and pointer receivers
225 return manager.SecretFactory, nil
226}
227
228func (manager VaultManager) Close(logger lager.Logger) {229 manager.ReAuther.Close()
230}
231
Type "VaultManager" has both value and pointer receivers
64 Params map[string]string `mapstructure:"auth_params" long:"auth-param" description:"Paramter to pass when logging in via the backend. Can be specified multiple times." value-name:"NAME:VALUE"`
65}
66
67func (manager *VaultManager) Init(log lager.Logger) error { 68 var err error
69
70 manager.Client, err = NewAPIClient(log, manager.URL, manager.ClientConfig, manager.TLS, manager.Auth, manager.Namespace, manager.QueryTimeout)
Type "CredHubManager" has both value and pointer receivers
36 ClientSecret string `long:"client-secret" description:"Client secret for CredHub authorization."`
37}
38
39func (manager *CredHubManager) MarshalJSON() ([]byte, error) { 40 health, err := manager.Health()
41 if err != nil {
42 return nil, err
Type "CredHubManager" has both value and pointer receivers
185 return lc.credhub, nil
186}
187
188func (manager CredHubManager) Close(logger lager.Logger) {189 // TODO - to implement
190}
Type "CredHubManager" has both value and pointer receivers
150 return healthResponse, nil
151}
152
153func (manager CredHubManager) NewSecretsFactory(logger lager.Logger) (creds.SecretsFactory, error) {154 return NewCredHubFactory(logger, manager.Client, manager.PathPrefix, manager.PathPrefixes), nil
155}
156
Type "CredHubManager" has both value and pointer receivers
114 return nil
115}
116
117func (manager CredHubManager) Health() (*creds.HealthResponse, error) {118 healthResponse := &creds.HealthResponse{
119 Method: "/health",
120 }
Type "CredHubManager" has both value and pointer receivers
99 manager.TLS.ClientKey != ""
100}
101
102func (manager CredHubManager) Validate() error {103 parsedUrl, err := url.Parse(manager.URL)
104 if err != nil {
105 return fmt.Errorf("invalid URL: %s", err)
Type "CredHubManager" has both value and pointer receivers
90 return nil
91}
92
93func (manager CredHubManager) IsConfigured() bool { 94 return manager.URL != "" ||
95 manager.UAA.ClientId != "" ||
96 manager.UAA.ClientSecret != "" ||
Type "CredHubManager" has both value and pointer receivers
54 return json.Marshal(&response)
55}
56
57func (manager *CredHubManager) Init(log lager.Logger) error { 58 var options []credhub.Option
59 if manager.TLS.Insecure {
60 options = append(options, credhub.SkipTLSValidation(true))
Description
(Go's FAQ)[https://go.dev/doc/faq#methodsonvaluesorpointers] recommends that method receivers should be consistent. If some of the methods of the type must have pointer receivers, the rest should too, so the method set is consistent regardless of how the type is used. This is because value and pointer receivers have different method sets.
Bad practice
package main
type foo struct {
a int
}
func (f foo) a() {}
func (f *foo) b() {
f.a = 10
}
Recommended
package main
type foo struct {
a int
}
func (f *foo) a() {}
func (f *foo) b() {
f.a = 10
}