Skip to content

[Issue] cannot use _ as value or type #10

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

Open
LingLuoYi opened this issue Dec 6, 2024 · 1 comment
Open

[Issue] cannot use _ as value or type #10

LingLuoYi opened this issue Dec 6, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@LingLuoYi
Copy link

描述问题 · Describe the bug
After modifying the code and running it with -toolexec decorator, the error "cannot use _ as value or type" appears
期望 · Expected behavior
Normal operation

环境 (选其一) · Env (please complete the following information):

  • OS: Linux
  • Go: 1.23
  • go-decorator: 0.21.0

最小化可复现代码 · Minimize reproducible code
在这里贴代码或者提供代码仓库地址 · There is a code here or a link to code (), ref.

import (
      _ "github.com/dengsgo/go-decorator/decor"
     _ "leeks/user/internal/aop"
)
//go:decor aop.Get
func (l *GetLoginNonceLogic) GetLoginNonce(_ *pb.Empty) (*pb.LoginNonceResp, error) {
	randomString := xutils.GenerateRandomString(64)
	if err := l.svcCtx.Redis.Set(l.ctx, randomString, 0x1, 10*time.Minute).Err(); err != nil {
		return nil, status.Error(xcode.CommonError, err.Error())
	}
	return &pb.LoginNonceResp{
		Nonce: randomString,
	}, nil
}

编译执行的命令 · Build command
提供报错所执行的命令 · Commands executed by the compiled code。

go run -toolexec decorator service.go 
@dengsgo dengsgo added the bug Something isn't working label Dec 6, 2024
@dengsgo
Copy link
Owner

dengsgo commented Dec 6, 2024

Thanks for the feedback, the issue has been fixed in v0.22.0. Run the following command to upgrade:

# Install lasest version
$ go install github.com/dengsgo/go-decorator/cmd/decorator@latest

# View current version
$ decorator

Then, just recompile.

NOTE: After upgrading the version, in order not to be affected by the old cache, please force the project code to compile once when compiling it for the first time, for example:

go run -toolexec decorator -a service.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants