Skip to content

Conversation

@craig08
Copy link
Contributor

@craig08 craig08 commented Jan 7, 2026

Description

Fixes #5435

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

  • I have followed Contributing Guidelines from CONTRIBUTING.MD
  • Tests pass: go test -v ./.. (see Testing)
  • Code formatted: gofmt (see Formatting)
  • Vetting pass: go vet (see Formatting)
  • These samples need a new API enabled in testing projects to pass (let us know which ones)
  • These samples need a new/updated env vars in testing projects set to pass (let us know which ones)
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample
  • Please merge this PR for me once it is approved

@craig08 craig08 requested review from a team as code owners January 7, 2026 20:28
@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Jan 7, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @craig08, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses an issue with outdated Memorystore Go samples by modernizing the visit-counter Redis example. The changes involve updating dependency management to use local Go modules, enhancing the Docker build process with multi-stage builds for efficiency, and bringing the Kubernetes deployment configuration up to current API standards. The overall goal is to ensure the samples are current and follow best practices.

Highlights

  • Go Module Restructuring: The global memorystore/go.mod and memorystore/go.sum files have been removed, and a new go.mod and go.sum have been introduced specifically for the memorystore/redis sample. This localizes dependency management for the visit-counter application.
  • Dockerfile Modernization: The Dockerfile for the visit-counter application has been updated to use a multi-stage build process, transitioning from golang:1.24-alpine to golang:1.24-bookworm for building and debian:bookworm-slim for the final image. This improves image size and security. Go module commands (go mod download, go build) are now used, and the entrypoint has been updated.
  • Kubernetes API Version Update: The visit-counter.yaml Kubernetes deployment manifest has been upgraded from apiVersion: extensions/v1beta1 to apiVersion: apps/v1, and the required selector field with matchLabels has been added to the Deployment specification.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively modernizes the Memorystore Go samples. Key improvements include migrating to Go modules for dependency management, implementing a multi-stage Docker build for optimized images, and updating the Kubernetes manifest to a stable API version. These are all excellent changes. I've provided one suggestion on the Dockerfile to further improve build caching, following a pattern already used elsewhere in the repository.

@craig08 craig08 force-pushed the golang-sample-fix branch from 9f7a00a to 085c6c7 Compare January 7, 2026 20:34
@craig08 craig08 changed the title fix: fix outdated Memorystore golang samples fix(memorystore): fix outdated Memorystore golang samples Jan 7, 2026
@craig08
Copy link
Contributor Author

craig08 commented Jan 7, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively updates the outdated Memorystore Go samples by modernizing the Dockerfile with a multi-stage build, updating the Kubernetes deployment manifest to a current API version, and properly setting up Go modules. These changes are well-executed and improve the quality and maintainability of the samples. I have one minor suggestion regarding the new go.mod file to correctly reflect a direct dependency.

@craig08 craig08 force-pushed the golang-sample-fix branch from 085c6c7 to 6f54309 Compare January 7, 2026 20:51
@craig08
Copy link
Contributor Author

craig08 commented Jan 7, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request does a great job of updating the Memorystore Go sample. The move to a self-contained Go module, the update of the Kubernetes deployment YAML to apps/v1, and the modernization of the Dockerfile to use a multi-stage build are all excellent improvements. I've added a suggestion for the Dockerfile to further improve it by building a static binary and using a scratch base image, which will result in a smaller and more secure container image.

@craig08 craig08 force-pushed the golang-sample-fix branch from 6f54309 to 66f3231 Compare January 7, 2026 21:10
@craig08
Copy link
Contributor Author

craig08 commented Jan 7, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new Go module for a visit-counter application, updating its go.mod and go.sum files. The Dockerfile for the application's GKE deployment was refactored to use a multi-stage build, transitioning from golang:1.24-alpine to a golang:1.24-bookworm builder stage and a scratch final image, aiming for a smaller image size. Additionally, the Kubernetes visit-counter.yaml deployment manifest was updated from extensions/v1beta1 to apps/v1 and now includes the required selector field. A minor comment change was also made in main.go. The review comments point out that the refactored Dockerfile's final scratch image is missing an ENTRYPOINT to specify the application binary to run and an EXPOSE instruction for port documentation, suggesting their inclusion for proper container functionality and best practices.

@craig08 craig08 force-pushed the golang-sample-fix branch from 66f3231 to 06b8ffc Compare January 7, 2026 21:20
@craig08
Copy link
Contributor Author

craig08 commented Jan 7, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request provides a much-needed update to the Memorystore Go sample, bringing it up to modern standards. The changes are mostly well-executed, including refactoring the Go module, improving the Dockerfile with multi-stage builds, and updating the Kubernetes deployment manifest. These are great improvements. However, I found one issue with the Go version specified in the new go.mod file that will prevent the sample from building. Please see the detailed comment.

@craig08 craig08 force-pushed the golang-sample-fix branch from 06b8ffc to 84019a9 Compare January 7, 2026 21:23
@craig08
Copy link
Contributor Author

craig08 commented Jan 7, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request provides a much-needed update to the Memorystore Go samples, bringing them in line with modern practices. The changes are well-executed and improve the sample's correctness, security, and maintainability. Key improvements include updating the Kubernetes manifest to a current API version, significantly enhancing the Dockerfile with a multi-stage build for a smaller and more secure image, and cleaning up the Go module dependencies. The result is a more robust and up-to-date example for users. I have no further comments; the changes are excellent.

@craig08 craig08 force-pushed the golang-sample-fix branch from 84019a9 to df4a94c Compare January 7, 2026 22:53
@snippet-bot
Copy link

snippet-bot bot commented Jan 7, 2026

Here is the summary of changes.

You are about to add 1 region tag.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@craig08 craig08 force-pushed the golang-sample-fix branch from df4a94c to 379b822 Compare January 9, 2026 00:51
@craig08
Copy link
Contributor Author

craig08 commented Jan 29, 2026

@iennae are you able to review this PR?

Copy link

@rodydavis rodydavis left a comment

Choose a reason for hiding this comment

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

LGTM

@craig08 craig08 requested a review from a team as a code owner January 30, 2026 19:04
@iennae iennae added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 30, 2026
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Outdated golang code samples for Memorystore for Redis

4 participants