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

feat(internal/carver): add tooling to help carve out sub-modules #4417

Merged
merged 9 commits into from Jul 26, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 36 additions & 0 deletions internal/carver/README.md
@@ -0,0 +1,36 @@
# carver

This is a tool used to carve out new modules in cloud.google.com/go.

## Usage

### Flags
codyoss marked this conversation as resolved.
Show resolved Hide resolved

```text
-parent string
The path to the parent module.
-child string
The relative path to the child module from the parent module.
-repo-metadata string
The full path to the repo metadata file.
-dry-run
If true no files or tags will be created. Optional.
-name string
The name used to identify the API in the README. Optional
-parent-tag string
The newest tag from the parent module. If not specified the latest tag will
be used. Optional.
-child-tag-version string
The tag version of the carved out child module. Should be in the form of
vX.X.X with no prefix. Optional.
-parent-tag-prefix string
The prefix for a git tag, should end in a '/'. Only required if parent is
not the root module. Optional.
```

```bash
go run cmd/main.go \
-parent=/path/to/google-cloud-go \
-child=asset \
-repo-metadata=/path/to/google-cloud-go/internal/.repo-metadata-full.json
```
6 changes: 6 additions & 0 deletions internal/carver/cmd/_CHANGES.md.txt
@@ -0,0 +1,6 @@
# Changes

## v0.1.0

This is the first tag to carve out {{.Package}} as its own module. See:
codyoss marked this conversation as resolved.
Show resolved Hide resolved
[Add a module to a multi-module repository](https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository).
38 changes: 38 additions & 0 deletions internal/carver/cmd/_README.md.txt
@@ -0,0 +1,38 @@
# {{.Name}}

[![Go Reference](https://pkg.go.dev/badge/{{.ImportPath}}.svg)](https://pkg.go.dev/{{.ImportPath}})

Go Client Library for {{.Name}}.

## Import
codyoss marked this conversation as resolved.
Show resolved Hide resolved

```bash
go get {{.ImportPath}}
```

## Stability

The stability of this module is indicated by semver. That said, some stable
modules will include unstable packages in them. You can identify if a package is
unstable if the import path includes alpha or beta and/or if it is noted in the
package documentation.
codyoss marked this conversation as resolved.
Show resolved Hide resolved

## Go Version Support

See the [Go Versions Supported](https://github.com/googleapis/google-cloud-go#go-versions-supported)
section in the root directory's README.

## Authorization

See the [Authorization](https://github.com/googleapis/google-cloud-go#authorization)
section in the root directory's README.

## Contributing

Contributions are welcome. Please, see the[CONTRIBUTING](https://github.com/GoogleCloudPlatform/google-cloud-go/blob/master/CONTRIBUTING.md)
codyoss marked this conversation as resolved.
Show resolved Hide resolved
document for details.

Please note that this project is released with a Contributor Code of Conduct.
By participating in this project you agree to abide by its terms. See
[Contributor Code of Conduct](https://github.com/GoogleCloudPlatform/google-cloud-go/blob/master/CONTRIBUTING.md#contributor-code-of-conduct)
for more information.
22 changes: 22 additions & 0 deletions internal/carver/cmd/_tidyhack_tmpl.txt
@@ -0,0 +1,22 @@
// Copyright {{.Year}} Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// This file, and the {{.RootMod}} import, won't actually become part of
// the resultant binary.
// +build modhack

package {{.Package}}

// Necessary for safely adding multi-module repo. See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository
import _ "{{.RootMod}}"