Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
codyoss committed Jan 7, 2021
2 parents c45ee91 + fed8979 commit 81faf39
Show file tree
Hide file tree
Showing 36 changed files with 2,224 additions and 80 deletions.
2 changes: 2 additions & 0 deletions cmd/go-cloud-debug-agent/internal/debug/dwarf/frame_test.go
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build linux

package dwarf_test

import (
Expand Down
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build go1.10
// +build linux,go1.10

package dwarf_test

Expand Down
2 changes: 2 additions & 0 deletions cmd/go-cloud-debug-agent/internal/debug/gosym/pclntab_test.go
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build linux

package gosym

import (
Expand Down
2 changes: 2 additions & 0 deletions cmd/go-cloud-debug-agent/internal/debug/remote/remote.go
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build linux

// Package remote provides remote access to a debugproxy server.
package remote

Expand Down
2 changes: 2 additions & 0 deletions httpreplay/cmd/httpr/integration_test.go
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build linux

package main_test

import (
Expand Down
6 changes: 4 additions & 2 deletions internal/gapicgen/cmd/genbot/README.md
Expand Up @@ -16,8 +16,10 @@ information on how that's done can be found here:
Note: this may change your `~/.gitconfig`, `~/.gitcookies`, and use up
non-trivial amounts of space on your computer.

1. Make sure you have all the tools installed listed in genlocal's README.md
2. Run:
1. Make sure you are on a non-Windows platform. If you are using windows
continue on to the docker instructions.
2. Make sure you have all the tools installed listed in genlocal's README.md
3. Run:

```shell
cd /path/to/internal/gapicgen
Expand Down
2 changes: 2 additions & 0 deletions internal/gapicgen/cmd/genbot/generate.go
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build !windows

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions internal/gapicgen/cmd/genbot/github.go
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build !windows

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions internal/gapicgen/cmd/genbot/main.go
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build !windows

// genbot is a binary for generating gapics and creating CLs/PRs with the results.
// It is intended to be used as a bot, though it can be run locally too.
package main
Expand Down
2 changes: 2 additions & 0 deletions internal/gapicgen/cmd/genbot/update.go
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build !windows

package main

import (
Expand Down
38 changes: 21 additions & 17 deletions internal/gapicgen/cmd/genlocal/README.md
Expand Up @@ -6,25 +6,29 @@ run generators against googleapis-private, and various other local tasks.

## Required tools

1. Install [docker](https://www.docker.com/get-started)
*Note*: If you are on a Windows platform you will need to install these tools
in a linux docker container: [Install docker](https://www.docker.com/get-started)

1. Install [protoc](https://github.com/protocolbuffers/protobuf/releases)
1. Install [Go](http://golang.org/dl)
1. Install python3, pip3
1. Install virtualenv `pip3 install virtualenv`
1. Install Go tools:

```
go get \
github.com/golang/protobuf/protoc-gen-go \
golang.org/x/lint/golint \
golang.org/x/tools/cmd/goimports \
honnef.co/go/tools/cmd/staticcheck \
github.com/googleapis/gapic-generator-go/cmd/protoc-gen-go_gapic
```
2. Install [Go](http://golang.org/dl)
3. Install python3, pip3
4. Install virtualenv `pip3 install virtualenv`
5. Install Go tools:

```bash
go get \
github.com/golang/protobuf/protoc-gen-go \
golang.org/x/lint/golint \
golang.org/x/tools/cmd/goimports \
honnef.co/go/tools/cmd/staticcheck \
github.com/googleapis/gapic-generator-go/cmd/protoc-gen-go_gapic
```

## Running

```
cd /path/to/internal/gapicgen
`git clone` this project if you don't already have it checked-out locally.

```bash
cd /path/to/google-cloud-go/internal/gapicgen
go run cloud.google.com/go/internal/gapicgen/cmd/genlocal
```
```
2 changes: 2 additions & 0 deletions internal/gapicgen/cmd/genlocal/main.go
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build !windows

// genlocal is a binary for generating gapics locally. It may be used to test out
// new changes, test the generation of a new library, test new generator tweaks,
// run generators against googleapis-private, and various other local tasks.
Expand Down
2 changes: 2 additions & 0 deletions internal/gapicgen/generator/generator.go
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build !windows

// Package generator provides tools for generating clients.
package generator

Expand Down
2 changes: 2 additions & 0 deletions internal/gapicgen/tools.go
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build !windows

// Package gapicgen provides some helpers for gapicgen binaries.
package gapicgen

Expand Down
2 changes: 1 addition & 1 deletion internal/godocfx/main.go
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build go1.15
// +build linux,go1.15

/*Command godocfx generates DocFX YAML for Go code.
Expand Down
2 changes: 2 additions & 0 deletions internal/pretty/diff.go
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build linux

package pretty

import (
Expand Down
2 changes: 2 additions & 0 deletions profiler/integration_test.go
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build linux

package profiler

import (
Expand Down
78 changes: 74 additions & 4 deletions pubsublite/README.md
@@ -1,6 +1,76 @@
## Cloud Pub/Sub Lite [![GoDoc](https://godoc.org/cloud.google.com/go/pubsublite?status.svg)](https://godoc.org/cloud.google.com/go/pubsublite)
## Cloud Pub/Sub Lite [![GoDoc](https://godoc.org/cloud.google.com/go/pubsublite?status.svg)](https://pkg.go.dev/cloud.google.com/go/pubsublite)

- [About Cloud Pub/Sub Lite](https://cloud.google.com/pubsub/lite/docs)
- [About Cloud Pub/Sub Lite](https://cloud.google.com/pubsub/lite)
- [Client library documentation](https://cloud.google.com/pubsub/lite/docs/reference/libraries)
- [API documentation](https://cloud.google.com/pubsub/lite/docs/apis)
- [Go client documentation](https://pkg.go.dev/cloud.google.com/go/pubsublite)

*This library is under development and will not provide a delightful user
experience until v1.0.0 has been released.*
*This library is in ALPHA. Backwards-incompatible changes may be made before
stable v1.0.0 is released.*

### Example Usage

[snip]:# (imports)
```go
import (
"cloud.google.com/go/pubsub"
"cloud.google.com/go/pubsublite"
"cloud.google.com/go/pubsublite/ps"
)
```

To publish messages to a topic:

[snip]:# (publish)
```go
// Create a PublisherClient for topic1.
// See https://cloud.google.com/pubsub/lite/docs/locations for available zones.
topic := pubsublite.TopicPath{
Project: "project-id",
Zone: "us-central1-b",
TopicID: "topic1",
}
publisher, err := ps.NewPublisherClient(ctx, ps.DefaultPublishSettings, topic)
if err != nil {
log.Fatal(err)
}

// Publish "hello world".
res := publisher.Publish(ctx, &pubsub.Message{
Data: []byte("hello world"),
})
// The publish happens asynchronously.
// Later, you can get the result from res:
...
msgID, err := res.Get(ctx)
if err != nil {
log.Fatal(err)
}
```

To receive messages for a subscription:

[snip]:# (subscribe)
```go
// Create a SubscriberClient for subscription1.
subscription := pubsublite.SubscriptionPath{
Project: "project-id",
Zone: "us-central1-b",
SubscriptionID: "subscription1",
}
subscriber, err := ps.NewSubscriberClient(ctx, ps.DefaultReceiveSettings, subscription)
if err != nil {
log.Fatal(err)
}

// Use a callback to receive messages.
// Call cancel() to stop receiving messages.
cctx, cancel := context.WithCancel(ctx)
err = subscriber.Receive(cctx, func(ctx context.Context, m *pubsub.Message) {
fmt.Println(m.Data)
m.Ack() // Acknowledge that we've consumed the message.
})
if err != nil {
log.Println(err)
}
```

0 comments on commit 81faf39

Please sign in to comment.