We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
go-model won't copy filed with the same type name,
go-model
following are the reproduce code.
package main import ( "encoding/json" "log" "golang.org/x/oauth2" go_model "gopkg.in/jeevatkm/go-model.v1" ) type Endpoint struct { AuthURL string `yaml:"auth_url" validate:"required,min=1"` TokenURL string `yaml:"token_url" validate:"required,min=1"` AuthStyle oauth2.AuthStyle `yaml:"auth_style" validate:"required,oneof=0 1 2"` } type OauthConfig struct { ClientID string `yaml:"client_id" validate:"required,min=1"` ClientSecret string `yaml:"client_secret" validate:"required,min=1"` Endpoint Endpoint RedirectURL string `yaml:"redirect_url" validate:"required,min=1"` Scopes []string `yaml:"scopes" example:"state"` } func DumpJson(obj interface{}) string { data, _ := json.Marshal(obj) return string(data) } func main() { var sample = OauthConfig{ ClientID: "aa", ClientSecret: "bb", Endpoint: Endpoint{ AuthURL: "https://sample.com", TokenURL: "https://sample.com", AuthStyle: 1, }, RedirectURL: "https://sample.com", Scopes: []string{"state"}, } var d = oauth2.Config{} go_model.Copy(&d, sample) log.Println(DumpJson(d)) }
sample code output:
2022/03/24 11:16:32 {"ClientID":"aa","ClientSecret":"bb","Endpoint":{"AuthURL":"","TokenURL":"","AuthStyle":0},"RedirectURL":"https://sample.com","Scopes":["state"]}
Endpoint fields are empty.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
go-model
won't copy filed with the same type name,following are the reproduce code.
sample code output:
Endpoint fields are empty.
The text was updated successfully, but these errors were encountered: