Delete variable assignment from variable declarations section in Go#2203
Open
DrAlexHarrison wants to merge 1 commit intorstacruz:masterfrom
Open
Delete variable assignment from variable declarations section in Go#2203DrAlexHarrison wants to merge 1 commit intorstacruz:masterfrom
DrAlexHarrison wants to merge 1 commit intorstacruz:masterfrom
Conversation
Admittedly, I'm at a junior dev level, but I believe the code as written is syntactically incorrect. I think that the `:` is required for `msg` to be declared as a variable. I don't believe you can just use the assignment operator (`=`) to declare `msg` as a variable by assigning it the value of `"Hello"` in the 'Go!' language like you can in python, dart, et al. Go! does have type inference but it must be done with the walrus operator (`:=`). Line 49 denotes that this is the `Variable Declaration` section so I believe the `:` preceding the `=` is necessary. On deeper checking, I think this line should be deleted because it's syntactically incorrect and the shortcut for variable declaration and assignment using the walrus operator is already covered below.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Admittedly, I'm at a junior dev level, but I believe the code as written is syntactically incorrect. I think that the
:is required formsgto be declared as a variable. I don't believe you can just use the assignment operator (=) to declaremsgas a variable by assigning it the value of"Hello"in the 'Go!' language like you can in python, dart, et al.Go! does have type inference but it must be done with the walrus operator (
:=). Line 49 denotes that this is theVariable Declarationsection so I believe the:preceding the=is necessary.On deeper checking, I think this line should be deleted because it's syntactically incorrect and the shortcut for variable declaration and assignment using the walrus operator is already covered below.