Skip to content
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

lib-version implementation #668

Closed
wants to merge 2 commits into from
Closed

Conversation

xxxserxxx
Copy link

Description:

Adds a lib-version command to print out the version of fyne that would be used to compile the project.

Fixes #656

Checklist:

  • Tests included.
  • Lint and formatter run with no errors.
  • Tests all pass.

Where applicable:

  • Public APIs match existing style. N/A
  • Any breaking changes have a deprecation path or have been discussed. N/A

Sean E. Russell added 2 commits February 9, 2020 08:40
Copy link
Member

@andydotxyz andydotxyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, functionally it's good and the test is solid.
However some of the naming could be improved. Unless it is clear from the context we try to avoid single or dual letter variable names - especially when a comment is required to explain their intent.

func TestParsePkgString(t *testing.T) {
type test struct {
in string // Test input
es string // Expected output
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use meaningful variable names? If it was "expectedOutput" then you wouldn't need the comment...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, the Fyne codebase doesn't follow Go stdlib conventions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not go so far as to say Fyne does not follow Go conventions, but I would say that the project follows the belief that if you have to have inline comments then your code could be clearer. Of course "i" is an iterator and "b" could be a buffer - where the context is clear and a convention is followed. I do not think that "es" is common shorthand for "expected output" - looking at slide#8 It would seem to indicate that "expected" could be completely inline with their recommendation.

}

for _, tc := range ts {
gs, ge := parsePkgString(tc.in)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear from the context what gs and ge are - could they be named more clearly?

type test struct {
in string // Test input
es string // Expected output
ee bool // Expecting error?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expectedError would imply an error type, perhaps shouldError is closer to the truth for a bool?


func (v *versioner) doVersion() error {
c := build.Default
p, e := c.Import(pkg, ".", build.FindOnly)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c, p, e and ve in this method are confusing - what are they short for?
Go normally uses "err" for an error var so that's a start. Could the other variables be more clearly named?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps in this instance build.Default could be set to "b" but I don't follow "c" as a choice. If "e" were "err" I still don't know what "p" and "ve" indicate?

cmd/fyne/version.go Show resolved Hide resolved
@andydotxyz
Copy link
Member

Private feedback from the developer is that they don't want to make the requested changes. Given that code style is very important to this project the PR will be closed without merge.

@andydotxyz andydotxyz closed this Feb 13, 2020
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.

2 participants