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

Generate Go code samples #369

Merged
merged 14 commits into from
Oct 11, 2024
Merged

Generate Go code samples #369

merged 14 commits into from
Oct 11, 2024

Conversation

razor-x
Copy link
Contributor

@razor-x razor-x commented Oct 9, 2024

No description provided.

@andrii-balitskyi
Copy link
Contributor

@razor-x There was a typo in the setup-go action which caused the generation workflow to fail. I've pushed a fix for it. Also, while testing our samples with gofmt, I discovered several bugs in the way we generate the Go code samples. I've fixed these issues in this PR. Once it's merged and blueprint is updated here, the Go formatting should work correctly.

@razor-x razor-x changed the title Generate Java, Go, and C# code samples Generate Go code samples Oct 10, 2024
@razor-x razor-x marked this pull request as ready for review October 10, 2024 22:51
@razor-x razor-x requested review from a team as code owners October 10, 2024 22:51
@razor-x razor-x self-assigned this Oct 10, 2024
import systems "github.com/seamapi/go/systems"

func main() {
client.Acs.Systems.List(context.Background(), systems.SystemsListRequest{ConnectedAccountId: api.String("123e4567-e89b-12d3-a456-426614174000")})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@andrii-balitskyi I was hoping gomft would break this long line. I wonder if we can force it to work if we add newlines after each argument.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I tested locally and it still doesn't seem to work with additional newlines:

func main() {
	client.Acs.Systems.List(
		context.Background(),
		systems.SystemsListRequest{
			ConnectedAccountId: api.String("123e4567-e89b-12d3-a456-426614174000")})
}

For example, the closing parenthesis of the List method and the closing curly brace of SystemsListRequest look off. However, it seems that's how gofmt works. If these closing characters were on a new line, gofmt would align them with their opening counterparts.

Copy link
Contributor

@andrii-balitskyi andrii-balitskyi Oct 11, 2024

Choose a reason for hiding this comment

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

Ok, with changes in this PR the final formatting looks good

func main() {
	client.Acs.Systems.List(
		context.Background(),
		systems.SystemsListRequest{
			ConnectedAccountId: api.String("123e4567-e89b-12d3-a456-426614174000"),
		},
	)
}

@razor-x razor-x merged commit 3db652a into main Oct 11, 2024
13 checks passed
@razor-x razor-x deleted the update-blueprint-0.27 branch October 11, 2024 23:51
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