

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# Go で並列テストを設定する
<a name="sample-parallel-test-go"></a>

以下は、Linux プラットフォームでの Go による並列テストの実行を示す `buildspec.yml` のサンプルです。

```
version: 0.2

batch:
  fast-fail: false
  build-fanout:
    parallelism: 5
    ignore-failure: false

phases:
  install:
    commands:
      - echo 'Fetching Go version'
      - go version
  pre_build:
    commands:
      - echo 'prebuild'
  build:
    commands:
      - echo 'Running go Tests'
      - go mod init calculator
      - cd calc
      - |
        codebuild-tests-run \
         --test-command "go test -v calculator.go" \
         --files-search "codebuild-glob-search '**/*test.go'"
  post_build:
    commands:
      - echo "Test execution completed"
```

上記の例では、`calculator.go` 関数にはテストする単純な数学関数が含まれており、すべてのテストファイルと `calculator.go` ファイルは `calc` フォルダ内にあります。