Skip to content

[BEAM-7154] Updating Go SDK errors (Part 2)#8462

Merged
aaltay merged 1 commit intoapache:masterfrom
youngoli:beam7154
May 2, 2019
Merged

[BEAM-7154] Updating Go SDK errors (Part 2)#8462
aaltay merged 1 commit intoapache:masterfrom
youngoli:beam7154

Conversation

@youngoli
Copy link
Contributor

@youngoli youngoli commented May 1, 2019

Updating standard Go error functionality (errors.New and fmt.Errorf) to use the newly added Beam "errors" package. This PR covers the following subdirectories under sdks/go/pkg/beam: io, options, provision, and runners.

I tried to keep the actual changes as straightforward as possible:

  1. If a call isn't wrapping another error, replace it with New or Errorf. This should be functionally identical.
  2. If a call is wrapping another error, replace it with either Wrap or WithContext using my best judgement. I generally used Wrap when the wrapped error originates from third-party code (i.e. any non-Beam package), and I tried to use WithContext otherwise.
  3. WithContext messages make the most sense in present tense (e.g. "doing foo", "reading bar"). This means I had to adjust some messages slightly, as little as I could without losing any useful information.

Only PR left after this is for the core subdirectory. That one might be a bit large so I wanted to separate it.


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

Post-Commit Tests Status (on master branch)

Lang SDK Apex Dataflow Flink Gearpump Samza Spark
Go Build Status --- --- --- --- --- ---
Java Build Status Build Status Build Status Build Status
Build Status
Build Status
Build Status Build Status Build Status
Python Build Status
Build Status
--- Build Status
Build Status
Build Status --- --- ---

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website
Non-portable Build Status Build Status Build Status Build Status
Portable --- Build Status --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

@youngoli
Copy link
Contributor Author

youngoli commented May 1, 2019

R: @lostluck

@lostluck
Copy link
Contributor

lostluck commented May 2, 2019

Mostly LGTM, but we must fix the pre-commit first:

16:34:36 > Task :beam-sdks-go:goTest FAILED
16:34:37 # github.com/apache/beam/sdks/go/pkg/beam/runners/direct
16:34:37 .gogradle/project_gopath/src/github.com/apache/beam/sdks/go/pkg/beam/runners/direct/direct.go:22:2: imported and not used: "fmt"
16:34:37 # github.com/apache/beam/sdks/go/pkg/beam/runners/universal/runnerlib
16:34:37 .gogradle/project_gopath/src/github.com/apache/beam/sdks/go/pkg/beam/runners/universal/runnerlib/execute.go:20:2: imported and not used: "fmt"
16:34:37 .gogradle/project_gopath/src/github.com/apache/beam/sdks/go/pkg/beam/runners/universal/runnerlib/stage.go:20:2: imported and not used: "fmt"

@youngoli
Copy link
Contributor Author

youngoli commented May 2, 2019

Strange, I ran goTest on my machine and it didn't catch any errors. I wonder if there's something different between my local environment and the Jenkins environment.

Anyway, fixed those so it should work now hopefully.

@lostluck
Copy link
Contributor

lostluck commented May 2, 2019

That's almost certainly the case, given the whole GoGradle, Versioning, Etc. situation the SDK is in. I do not recommend testing with the gradle commands locally under the vast majority of cases.

go test ./... should cover everything, but otherwise go build ./... would certainly catch it.

This commit changes errors from using standard Go error functionality
to using the internal Beam "errors" package. it covers the
subdirectories io, options, provision, and runners.
@youngoli
Copy link
Contributor Author

youngoli commented May 2, 2019

@aaltay for merge.

@aaltay aaltay merged commit 75eee78 into apache:master May 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants