m-lab / etl-embargo

Apache License 2.0
0 stars 1 forks source link

Unembargo2 #9

Closed yachang closed 7 years ago

yachang commented 7 years ago

Fix the rebase issues.


This change is Reviewable

stephen-soltesz commented 7 years ago

Reviewed 1 of 4 files at r1. Review status: 1 of 4 files reviewed at latest revision, 3 unresolved discussions.


unembargo.go, line 61 at r2 (raw file):

}

func (nc *config) NewConfig(privateBucketName, publicBucketName string) {

I suggest using a method signature like:

func NewConfig(privateBucketName, publicBucketName string) *config {
   ...
}

The NewConfig function can allocate a new config instance and return it populated with the bucket names.


unembargo.go, line 70 at r2 (raw file): Copying thread from pr #7.

From soltesz: Please only use type casts when necessary. Like this: https://play.golang.org/p/W1dPo1IBvX

Also, I'm sorry to have missed it before; please use use mixed case variable names rather than underscores. This is the convention in Go https://golang.org/doc/effective_go.html#mixed-caps

From yachang: If I do not use type casts, there will be errors like:

mismatched types int and time.Month

Right. I said "only when necessary". Did you look at the example? It is necessary for time.Month but not the other values.


unembargo_test.go, line 14 at r2 (raw file):

*/

package embargo

I believe we can define the test package differently from the package to guarantee that the tests use the public interface of the package under test.

So, here please use package embargo_test and update the tests to use the public embaro interface.


Comments from Reviewable

yachang commented 7 years ago

Review status: 1 of 4 files reviewed at latest revision, 3 unresolved discussions.


unembargo.go, line 61 at r2 (raw file):

Previously, stephen-soltesz (Stephen Soltesz) wrote…
I suggest using a method signature like: ``` func NewConfig(privateBucketName, publicBucketName string) *config { ... } ``` The `NewConfig` function can allocate a new `config` instance and return it populated with the bucket names.

Done.


unembargo.go, line 70 at r2 (raw file):

Previously, stephen-soltesz (Stephen Soltesz) wrote…
Copying thread from pr #7. > From soltesz: > Please only use type casts when necessary. Like this: https://play.golang.org/p/W1dPo1IBvX > > Also, I'm sorry to have missed it before; please use use mixed case variable names rather than underscores. This is the convention in Go https://golang.org/doc/effective_go.html#mixed-caps > > > From yachang: > > If I do not use type casts, there will be errors like: > > > > mismatched types int and time.Month Right. I said "only when necessary". Did you look at the example? It is necessary for time.Month but not the other values.

Done.


Comments from Reviewable

yachang commented 7 years ago

Review status: 1 of 4 files reviewed at latest revision, 3 unresolved discussions.


unembargo_test.go, line 14 at r2 (raw file):

Previously, stephen-soltesz (Stephen Soltesz) wrote…
I believe we can define the test package differently from the package to guarantee that the tests use the public interface of the package under test. So, here please use `package embargo_test` and update the tests to use the public embaro interface.

Done.


Comments from Reviewable

stephen-soltesz commented 7 years ago

Almost there! One more question.


Review status: 1 of 4 files reviewed at latest revision, 1 unresolved discussion.


unembargo_test.go, line 33 at r3 (raw file):

if (*testConfig).Unembargo(20160102) != nil {

Something is funny here. This should read like: testConfig.Unembargo(...). What is the dereference necessary?


Comments from Reviewable

yachang commented 7 years ago

Review status: 1 of 4 files reviewed at latest revision, 1 unresolved discussion.


unembargo_test.go, line 33 at r3 (raw file):

Previously, stephen-soltesz (Stephen Soltesz) wrote…
> if (*testConfig).Unembargo(20160102) != nil { Something is funny here. This should read like: `testConfig.Unembargo(...)`. What is the dereference necessary?

func NewConfig() returns *config


Comments from Reviewable

stephen-soltesz commented 7 years ago

Review status: 1 of 4 files reviewed at latest revision, 1 unresolved discussion.


unembargo_test.go, line 33 at r3 (raw file):

Previously, yachang wrote…
func NewConfig() returns *config

Yes, but Go handles dereferencing values automatically. This should not be necessary here.

Does the code work correctly as testConfig.Unembargo(20160102)?


Comments from Reviewable

yachang commented 7 years ago

Review status: 1 of 4 files reviewed at latest revision, 1 unresolved discussion.


unembargo_test.go, line 33 at r3 (raw file):

Previously, stephen-soltesz (Stephen Soltesz) wrote…
Yes, but Go handles dereferencing values automatically. This should not be necessary here. Does the code work correctly as `testConfig.Unembargo(20160102)`?

Done.


Comments from Reviewable

stephen-soltesz commented 7 years ago
:lgtm:

Review status: 1 of 4 files reviewed at latest revision, all discussions resolved.


Comments from Reviewable