zhufuyi / sponge Goto Github PK
View Code? Open in Web Editor NEWSponge is a powerful Go development framework, it's easy to develop web and microservice projects.
Home Page: https://go-sponge.com
License: MIT License
Sponge is a powerful Go development framework, it's easy to develop web and microservice projects.
Home Page: https://go-sponge.com
License: MIT License
Describe the bug
Mac M1 install sponge failed
The error is
> go install github.com/zhufuyi/sponge/cmd/sponge@latest
# github.com/shoenig/go-m1cpu
../../pkg/mod/github.com/shoenig/[email protected]/cpu.go:65:33: error: use of undeclared identifier 'kIOMainPortDefault'; did you mean 'kIOMasterPortDefault'?
IOServiceGetMatchingServices(kIOMainPortDefault, matching, &iter);
^~~~~~~~~~~~~~~~~~
kIOMasterPortDefault
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:103:19: note: 'kIOMasterPortDefault' declared here
const mach_port_t kIOMasterPortDefault;
sponge是一个很优秀的开发框架,提供了多种内置组件和快速开发方式。不过内置的组件较多来带的问题是:如果涉及到内置组件,比如gin或Consul的版本更新,请问这种组件更新一般如何处理比较好?如果直接使用更新组件版本是否会影响sponge框架逻辑?
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Describe the bug
https://go-sponge.com/zh-cn/quick-start?id=%e5%ae%89%e8%a3%85-sponge
根据文档的安装步骤,安装sponge的时候报错。
To Reproduce
Steps to reproduce the behavior, if applicable:
go version
go version go1.20.4 darwin/arm64
go install github.com/zhufuyi/sponge/cmd/sponge@latest
# github.com/zhufuyi/sponge/cmd/sponge
ld: warning: '/private/var/folders/jx/41jbkxb92y7cmh1cs8kznr6w0000gn/T/go-link-3333539147/go.o' has malformed LC_DYSYMTAB, expected 129 undefined symbols to start at index 43311, found 221 undefined symbols starting at index 76
生成Dao CRUD代码 ,下载代码时,报错:executable file not found in $PATH
有使用过goframe吗?某些功能可能使用gf 更容易实现
考虑出一版基于goframe的不
sponge init
initialize sponge ......
✔ upgraded sponge binary.
❌ upgrade template code.
Error: execute command failed, /bin/chmod: cannot access '/home/eric/.sponge/api': Permission denied
/bin/chmod: cannot access '/home/eric/.sponge/go.sum': Permission denied
/bin/chmod: cannot access '/home/eric/.sponge/doc.go': Permission denied
/bin/chmod: cannot access '/home/eric/.sponge/internal': Permission denied
Then I checked the permission of ~/.sponge
, it's mess:
eric@eric-pc:~$ ll .sponge/
ls: cannot access '.sponge/api': Permission denied
ls: cannot access '.sponge/go.sum': Permission denied
ls: cannot access '.sponge/doc.go': Permission denied
ls: cannot access '.sponge/internal': Permission denied
ls: cannot access '.sponge/Makefile-for-http': Permission denied
ls: cannot access '.sponge/Makefile': Permission denied
ls: cannot access '.sponge/.gitignore': Permission denied
ls: cannot access '.sponge/third_party': Permission denied
ls: cannot access '.sponge/cmd': Permission denied
ls: cannot access '.sponge/.': Permission denied
ls: cannot access '.sponge/docs': Permission denied
ls: cannot access '.sponge/codecov.yml': Permission denied
ls: cannot access '.sponge/..': Permission denied
ls: cannot access '.sponge/.golangci.yml': Permission denied
ls: cannot access '.sponge/scripts': Permission denied
ls: cannot access '.sponge/Jenkinsfile': Permission denied
ls: cannot access '.sponge/deployments': Permission denied
ls: cannot access '.sponge/examples': Permission denied
ls: cannot access '.sponge/test': Permission denied
ls: cannot access '.sponge/LICENSE': Permission denied
ls: cannot access '.sponge/configs': Permission denied
ls: cannot access '.sponge/README.md': Permission denied
ls: cannot access '.sponge/go.mod': Permission denied
ls: cannot access '.sponge/.github': Permission denied
ls: cannot access '.sponge/pkg': Permission denied
ls: cannot access '.sponge/assets': Permission denied
total 0
d????????? ? ? ? ? ? ./
d????????? ? ? ? ? ? ../
d????????? ? ? ? ? ? api/
d????????? ? ? ? ? ? assets/
d????????? ? ? ? ? ? cmd/
-????????? ? ? ? ? ? codecov.yml
d????????? ? ? ? ? ? configs/
d????????? ? ? ? ? ? deployments/
-????????? ? ? ? ? ? doc.go
d????????? ? ? ? ? ? docs/
d????????? ? ? ? ? ? examples/
d????????? ? ? ? ? ? .github/
-????????? ? ? ? ? ? .gitignore
-????????? ? ? ? ? ? .golangci.yml
-????????? ? ? ? ? ? go.mod
-????????? ? ? ? ? ? go.sum
d????????? ? ? ? ? ? internal/
-????????? ? ? ? ? ? Jenkinsfile
-????????? ? ? ? ? ? LICENSE
-????????? ? ? ? ? ? Makefile
-????????? ? ? ? ? ? Makefile-for-http
d????????? ? ? ? ? ? pkg/
-????????? ? ? ? ? ? README.md
d????????? ? ? ? ? ? scripts/
d????????? ? ? ? ? ? test/
d????????? ? ? ? ? ? third_party/
Describe the bug
通过go install方式安装指定版本时,始终都会自动安装最新的版本,例如:
[dev@dev bin]$ go install github.com/zhufuyi/sponge/cmd/[email protected]
go: github.com/zhufuyi/sponge/cmd/[email protected]: github.com/zhufuyi/sponge/cmd/[email protected]: invalid version: unknown revision 1.8.0
[dev@dev bin]$ go install github.com/zhufuyi/sponge/cmd/[email protected]
go: downloading github.com/zhufuyi/sponge v1.8.0
go: downloading github.com/huandu/xstrings v1.3.3
[dev@dev bin]$ sponge -v
sponge version v1.8.1
Environments (please complete the following information):
More description
none
我在阿里服务器搭建了sponge和MySQL,数据库已经建立好,按照格式填写好DSN后无法获取表名,无论是内网地址,本地地址,外网地址都不行,我电脑使用Python脚本测试可以远程连接到MySQL数据库,Go版本1.22.4
可以考虑将rpcx加入进去
大佬, 有计划把go-redis裤,改成v9版本么?
2024/06/08 21:53:53 Error parsing type definition 'types.ListObjDetail': cannot find type definition: UnSupport
2024/06/08 21:53:53 Error parsing type definition 'types.GetListByIDRespond': cannot find type definition: UnSupport
2024/06/08 21:53:53 ParseComment error in file /home/panda/Projects/web/tiku-web-http-214418/internal/handler/list.go :cannot find type definition: UnSupport
make: *** [Makefile:43: docs] Error 1
系统win11,根据proto文件创建rpc服务已生成好文件。进入生成的目录下执行make proto 报错 protoc: command not found.
实际上已经安装了protoc的
Describe the bug
我在通过命令创建项目时,make proto出现错误。
执行的命令如下:
sponge web http-pb --module-name=tidy --server-name=tidy --project-name=tidy --protobuf-file=./tidy.proto --out=./generate
sponge web handler-pb --db-dsn='root:123456@(127.0.0.1:3306)/tidy' --db-table=task,target --out=./generate --module-name=github.com/Rvn0xsy/tidy
在执行第二条命令时,出现如下错误:
go: found github.com/zhufuyi/sponge/pkg/gin/validator in github.com/zhufuyi/sponge v1.5.0
go: found github.com/zhufuyi/sponge/pkg/jwt in github.com/zhufuyi/sponge v1.5.0
go: found github.com/zhufuyi/sponge/pkg/gotest in github.com/zhufuyi/sponge v1.5.0
go: found github.com/zhufuyi/sponge/pkg/gofile in github.com/zhufuyi/sponge v1.5.0
gofmt -s -w .
api/types/types.proto: File not found.
api/tidy/v1/target.proto:5:1: Import "api/types/types.proto" was not found or had errors.
api/tidy/v1/target.proto:231:3: "types.Params" is not defined.
make: *** [Makefile:81:proto] 错误 1
我的tidy.proto文件内容如下:
syntax = "proto3";
package api.tidy.v1;
import "google/api/annotations.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
option go_package = "tidy/api/user/v1;v1";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
host: "localhost:8080"
base_path: ""
info: {
title: "user api docs";
version: "2.0";
};
schemes: HTTP;
schemes: HTTPS;
consumes: "application/json";
produces: "application/json";
};
service user {
rpc Login(LoginRequest) returns (LoginReply) {
option (google.api.http) = {
post: "/api/v1/login"
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "登录",
description: "使用邮箱登录",
};
}
}
message LoginRequest {
string email = 1;
string password = 2;
}
message LoginReply {
string token = 1;
}
根据大致意思能够了解到,是Import "api/types/types.proto" 这个文件缺失,这个文件貌似没有生成。
sponge的版本:
$ sponge -v
sponge version v1.5.0
功能挺好,代码挺乱!
Will consider supporting GraphQL in the future? thanks
一直卡在这个界面了
我有一个类似的功能, 直接用 golang 定义接口然后生成代码
https://github.com/mei-rune/gogen/blob/master/intro.md
但是我不喜欢它, 当初也想过用 protoc 生成, 但因为已有功能的原因没有用 protoc , 现在发现了这个,请问能不能将 代码生成拆分出来, 成为一个独立的工具。
这样子,我们可以在原来的框架下无痛引入这个工具来提高效率。
按照文档生成项目结构目录,文件下载后解压为空文档。
按照安装流程对比了几次,没有发现缺漏步骤,不知是什么问题,或者哪里可以看到文件生成的日志。
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
根据sql生成web服务,点击下载代码提示
Internal Server Error, exec: "sponge": cannot run executable found relative to current directory
The UI is currently unusable for international community.
Would it be so difficult to translate it?
Is your feature request related to a problem? Please describe.
表 ue_proxy希望生成的model等,不使用UeProxy而是使用Proxy,不要Ue前缀
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior, if applicable:
go version go1.21.0 darwin/arm64
sponge init
panic: cgroup cpu init failed!err:=not implemented yet
goroutine 1 [running]:
github.com/zhufuyi/sponge/pkg/shield/cpu.init.0()
/Users/user/go/pkg/mod/github.com/zhufuyi/[email protected]/pkg/shield/cpu/stat.go:33 +0xfc
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Environments (please complete the following information):
More description
Add any other context about the problem here.
../../../golang/pkg/mod/go.opentelemetry.io/[email protected]/internal/global/handler.go:44:18: undefined: atomic.Pointer
../../../golang/pkg/mod/go.opentelemetry.io/[email protected]/internal/global/internal_logging.go:30:25: undefined: atomic.Pointer
note: module requires Go 1.20
Screenshots
If applicable, add screenshots to help explain your problem.
Environments (please complete the following information):
More description
Add any other context about the problem here.
在视频中我看到比方说有三个rpc服务,一个网关服务,然后通过网关服务去调用rpc服务。
如果我有这样一个需求,我不需要网关服务,我有一个protobuff生成的web服务,里面都是暴露给前台的接口,这个时候我其中一个接口想调用一个rpc服务,这个可以通过代码自动生成去实现么?
如果可以的话还有一个问题,比方说名称相同的情况,web服务有一个叫user.proto文件而rpc服务中也有一个叫user.proto的文件,当然,如果两个服务都是同一个项目组去做可以通过命名的方式去做区分,但是也有可能是两个不同的项目组,这样同名的情况应该怎么办?
做分层可以让使用更加灵活
Error: the port parameter is invalid, e.g. sponge run --port=8080 --addr=http://192.168.1.10:8080
填写表单,后点 下载代码 报错
The error is
Internal Server Error, exec: "sponge": cannot run executable found relative to current directory
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior, if applicable:
The code is
The error is
有可能是数据库字段类型的错误?
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Environments (please complete the following information):
More description
Add any other context about the problem here.
如图所示
Describe the bug
Time.Now 数据库字段datetime ,在dao结构体中gorm是指针,但是test文件里面是给的不是地址
To Reproduce
Steps to reproduce the behavior, if applicable:
The code is
The error is
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Environments (please complete the following information):
More description
Add any other context about the problem here.
$ sponge init
initialize sponge ......
❌ upgrade sponge binary.
Error: go: github.com/zhufuyi/sponge/cmd/sponge@latest: module github.com/zhufuyi/sponge/cmd/sponge: Get "https://proxy.golang.org/github.com/zhufuyi/sponge/cmd/sponge/@v/list": dial tcp 172.217.160.113:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Describe the bug
生成文档时swag会报错
To Reproduce
Steps to reproduce the behavior, if applicable:
The code is
// @title ChatGPT_MJ_aggregation_next api docs
// @description http server api docs
// @schemes http https
// @Version 2.0
// @host localhost:8080
// @securityDefinitions.apikey BearerAuth
// @in header
// @name Authorization
// @description "Type Bearer your-jwt-token" to Value
func main() {
initial.InitApp()
services := initial.CreateServices()
closes := initial.Close(services)
a := app.New(services, closes)
a.Run()
}
2. The error is
// @description "Type Bearer your-jwt-token" to Value
3.将// @description "Type Bearer your-jwt-token" to Value 改成
// @description Type Bearer your-jwt-token to Value 可以解决
RT
如题。谢谢
如何直接返回validate的信息呢,如果要把每个validate都定义ecode有点费劲
建议支持下pgsql,或完全兼容gorm所支持的那几种数据库
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.