Question 576 of 999
Building and testing applicationshardMultiple ChoiceObjective-mapped

Speed Up Go Builds with Cloud Build Volume Caching

This PCD practice question tests your understanding of building and testing applications. This is a configuration task: choose the command set that satisfies every stated requirement. Small differences — like 'secret' vs 'password' or 'transport input ssh' vs 'all' — change whether the answer is correct. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

A team is using Cloud Build to build a Go application. They want to cache Go module dependencies across builds to speed up builds. Which configuration should they add to cloudbuild.yaml?

Quick Answer

The correct answer is to use Cloud Build’s built-in caching feature by specifying a volume in the `cloudbuild.yaml` configuration. This works because Cloud Build allows you to mount a persistent volume, such as `/go/pkg/mod`, and set the `cache` option to retain the Go module cache across build steps, eliminating redundant dependency downloads and dramatically speeding up subsequent builds. On the Google Professional Cloud Developer exam, this scenario tests your understanding of native Cloud Build caching versus external solutions like Cloud Storage or Artifact Registry—a common trap is overcomplicating the answer by adding unnecessary services when a simple volume mount suffices. Remember that for Go module caching, the volume path must match Go’s default cache directory, and the `cache` key in the volume definition is what triggers persistence. Memory tip: think “Go mod cache = volume mount + cache key” to avoid reaching for external storage.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Use Cloud Build's built-in caching feature by specifying a volume

To cache Go module dependencies across builds in Cloud Build, you can mount a volume backed by Cloud Storage in your build steps. This is done by specifying a `volume` in the `cloudbuild.yaml` configuration that uses a bucket (e.g., via `gcs-fuse`). The Go module cache directory (e.g., `/go/pkg/mod`) is stored in the bucket, so it persists across different builds, significantly reducing dependency download time. This approach is a built-in caching feature of Cloud Build when combined with Cloud Storage.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Use a custom builder that pre-installs dependencies

    Why it's wrong here

    Pre-installing in a custom builder works but requires rebuilding the builder when dependencies change, and doesn't automatically cache across builds.

  • Set up a bucket for caching and use substitutions

    Why it's wrong here

    Manually managing caching via a bucket is error-prone; Cloud Build volumes are purpose-built for this.

  • Use a Kaniko cache with a remote repository

    Why it's wrong here

    Kaniko cache is for Docker image layers, not for Go module downloads.

  • Use Cloud Build's built-in caching feature by specifying a volume

    Why this is correct

    Specifying a volume (e.g., `volumes: [{name: 'go-mod', path: '/go/pkg/mod'}]`) persists the directory across build steps and triggers, avoiding re-downloads.

    Related concept

    Read the scenario before looking for a memorised answer.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The PCD exam often tests the distinction between container image caching (Kaniko) and application dependency caching (Cloud Build volumes), leading candidates to confuse the purpose of Kaniko cache with the need for dependency caching.

Detailed technical explanation

How to think about this question

Cloud Build's volume caching works by specifying a `volume` with a `name` and `path` in the build step, and setting `'cache': true` in the `options` section of `cloudbuild.yaml`. Under the hood, Cloud Build mounts a persistent volume that is reused across builds within the same region and project, but note that the cache is not shared across different builds or projects and has a limited retention period (typically 7 days). In real-world scenarios, this is especially beneficial for large Go projects with hundreds of dependencies, where downloading modules from scratch can add minutes to the build time.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A media company stores terabytes of video archives that are accessed once a year for audit purposes. Moving these objects to a cold storage tier (Azure Archive, S3 Glacier, or Google Nearline) costs a fraction of hot storage. Questions like this test whether you understand storage tiers, access frequency tradeoffs, and retrieval latency requirements.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related PCD practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Manage a Solution that Can Span Multiple Database Systems practice questions

Practise PCD questions linked to Manage a Solution that Can Span Multiple Database Systems.

Deploy Scalable and Highly Available Databases in Google Cloud practice questions

Practise PCD questions linked to Deploy Scalable and Highly Available Databases in Google Cloud.

Design Scalable and Highly Available Cloud Database Solutions practice questions

Practise PCD questions linked to Design Scalable and Highly Available Cloud Database Solutions.

Migrate Data Solutions practice questions

Practise PCD questions linked to Migrate Data Solutions.

Designing highly scalable, available, and reliable cloud-native applications practice questions

Practise PCD questions linked to Designing highly scalable, available, and reliable cloud-native applications.

Building and testing applications practice questions

Practise PCD questions linked to Building and testing applications.

Deploying applications practice questions

Practise PCD questions linked to Deploying applications.

Integrating Google Cloud services practice questions

Practise PCD questions linked to Integrating Google Cloud services.

Managing application performance monitoring practice questions

Practise PCD questions linked to Managing application performance monitoring.

PCD fundamentals practice questions

Practise PCD questions linked to PCD fundamentals.

PCD scenario practice questions

Practise PCD questions linked to PCD scenario.

PCD troubleshooting practice questions

Practise PCD questions linked to PCD troubleshooting.

Practice this exam

Start a free PCD practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this PCD question test?

Building and testing applications — This question tests Building and testing applications — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Use Cloud Build's built-in caching feature by specifying a volume — To cache Go module dependencies across builds in Cloud Build, you can mount a volume backed by Cloud Storage in your build steps. This is done by specifying a `volume` in the `cloudbuild.yaml` configuration that uses a bucket (e.g., via `gcs-fuse`). The Go module cache directory (e.g., `/go/pkg/mod`) is stored in the bucket, so it persists across different builds, significantly reducing dependency download time. This approach is a built-in caching feature of Cloud Build when combined with Cloud Storage.

What should I do if I get this PCD question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Keep practising

More PCD practice questions

Last reviewed: Jun 25, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This PCD practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCD exam.