-
Notifications
You must be signed in to change notification settings - Fork 1.8k
automl: remove old files and update region tags for samples #1119
New issue
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
Conversation
package automl | ||
|
||
// [START automl_get_dataset] | ||
// [START automl_language_entity_extraction_get_dataset] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure all of the imports are the same and all of the whitespace is correct here? For some samples, this can make sense, but it isn't immediately obvious during review that these regions are correct. Separate files are more up front work, but very clearly correct (and don't accidentally get messed up when there is a new import).
(Go will fail to compile if there is an extra import.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean technically all of the automl samples should all have been on the v1 library not the v1beta1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my mistake, fixing that in #1122
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I meant all of the imports. Not just the API import. The reason the standard is to use separate files (https://github.com/GoogleCloudPlatform/golang-samples/blob/master/CONTRIBUTING.md#one-file-per-sample) is so that we're 100% sure the sample will work when copied and pasted from cloud.google.com.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's also very easy to mess up start/end tags when going in and out of functions (looking at the rest of the PR). I'm not sure every region is correct, so I'd prefer separate files, if you don't mind. gofmt
should pass for every region, too.
Sometimes this type of setup works, but Go is weird with import and formatting requirements, so we have to be careful. :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the go folks want to maintain a bunch of additional files, that is fine. The goal of this was to move us away from maintaining 1400 files to about 400 for AutoML snippets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Y'all will be maintaining the samples. So, if you prefer to do it this way, it seems correct from what I can tell. Let's go ahead with this as-is and we can change it later if needed. Sorry for the back and forth.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
package automl | ||
|
||
// [START automl_get_dataset] | ||
// [START automl_language_entity_extraction_get_dataset] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Y'all will be maintaining the samples. So, if you prefer to do it this way, it seems correct from what I can tell. Let's go ahead with this as-is and we can change it later if needed. Sorry for the back and forth.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind fixing the merge conflicts with master?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran gofmt
, but the PR is failing to compile: https://source.cloud.google.com/results/invocations/ff0442c0-569c-4121-9af2-c287a0eb53d1/targets/cloud-devrel%2Fgo%2Fgolang-samples%2Fpresubmit%2Fgo113/log
vet: automl/model_evaluation_list.go:78:82: evaluation.GetTextSentimentAnalysisEvaluationMetrics undefined (type *v1.ModelEvaluation has no field or method GetTextSentimentAnalysisEvaluationMetrics)
No description provided.