我正在构建Go 1.11标准App Engine服务。
它不在GOPATH
下,所以我分别运行了go mod init
和go mod tidy
。
我能够使用go build
构建一个简单的Web服务,并使用gcloud app deploy
进行部署和测试。
我现在正尝试在this code example之后向我的服务添加gPubSub代码。
这将添加以下导入:"context"
,"cloud.google.com/go/pubsub"
。
运行go build
时,我得到:
../../../../go/pkg/mod/golang.org/x/net@v0.0.0-20181217023233-e147a9138326/idna/idna.go:23:2: unknown import path "golang.org/x/text/secure/bidirule": cannot find module providing package golang.org/x/text/secure/bidirule
../../../../go/pkg/mod/golang.org/x/net@v0.0.0-20181217023233-e147a9138326/idna/idna.go:24:2: unknown import path "golang.org/x/text/unicode/bidi": cannot find module providing package golang.org/x/text/unicode/bidi
../../../../go/pkg/mod/golang.org/x/net@v0.0.0-20181217023233-e147a9138326/idna/idna.go:25:2: unknown import path "golang.org/x/text/unicode/norm": cannot find module providing package golang.org/x/text/unicode/norm
运行go get -u all
时,我收到“没有Go文件”
go build golang.org/x/text/secure/bidirule: no Go files in
go build golang.org/x/text/unicode/bidi: no Go files in
go build golang.org/x/text/unicode/norm: no Go files in
cat go.mod
向我显示了以下内容:
```
module github.com/XXX/YYY
require (
cloud.google.com/go v0.34.0
github.com/googleapis/gax-go v2.0.2+incompatible // indirect
go.opencensus.io v0.18.0 // indirect
golang.org/x/net v0.0.0-20181217023233-e147a9138326 // indirect
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890 // indirect
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f // indirect
golang.org/x/sys v0.0.0-20181218192612-074acd46bca6 // indirect
google.golang.org/api v0.0.0-20181220000619-583d854617af // indirect
google.golang.org/appengine v1.3.0 // indirect
google.golang.org/genproto v0.0.0-20181219182458-5a97ab628bfb // indirect
google.golang.org/grpc v1.17.0 // indirect
)
```
go list .
向我显示以下内容:
go: finding golang.org/x/text/unicode/bidi latest
go: finding golang.org/x/text/secure/bidirule latest
go: finding golang.org/x/text/unicode/norm latest
go: finding golang.org/x/text/unicode latest
go: finding golang.org/x/text/secure latest
github.com/XXX/YYY/ZZZ (our project)
这似乎是暂时的依赖性。
当我使用gcloud app deploy
进行部署时,我的服务确实成功构建并在执行时发布到pubsub主题,所以这是一个本地问题。
我如何诊断和解决此本地开发环境问题?
答案 0 :(得分:1)
已修复:
<?php
namespace App\Listeners;
use Illuminate\Mail\Events\MessageSending;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class LogSendingMessage
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param MessageSending $event
* @return void
*/
public function handle(MessageSending $event)
{
//here i want to check what mailable class used and stop it.
if ($mailable == 'Ordershipped')
return false;
// if another mailable class (example: userVerification)
else
return true;
}
}
rm -rf ~/go/pkg/mod/golang.org/x/text@v0.3.0