GoogleCloudPlatform / samples-style-guide

Guidelines on writing effective Google Cloud samples.
https://googlecloudplatform.github.io/samples-style-guide/
Apache License 2.0
11 stars 19 forks source link

Proposal: make Go snippets runnable #91

Open tritone opened 2 years ago

tritone commented 2 years ago

Description

We have gotten doc feedback issues complaining that the Go snippets are not readily copy-paste-runnable when written using the current guidelines. I'm not convinced that there is a better approach we could take, but filing an issue for discussion.

Impact

New guidelines could make it easier for users (especially newbies to Go) to run sample code files directly, or be able to paste it more easily into a main func.

Challenge

Potentially this could introduce even more cruft into snippet-type samples which are already quite long to include imports, client initialization and cleanup, etc, negatively impacting clarify for doc readers.

grayside commented 2 years ago

Could you provide some more specifics on things that should be changed?

In reading this proposal, my initial thought is whether this is about the current style guide, or about updating more of the golang samples to match the style guide.

kurtisvg commented 2 years ago

I think the discussion on this was about making it easy as possible to run the sample, which would mean including a main func users can use to execute.

grayside commented 2 years ago

That seems at odds with or be able to paste it more easily into a main func.

grayside commented 1 year ago

Assigned to @tritone for clarification.