Giter VIP home page Giter VIP logo

ego's People

Contributors

allcontributors[bot] avatar aschenmaker avatar askuy avatar clannadxr avatar cubxxw avatar cute-angelia avatar devincd avatar flutterwang avatar flycash avatar hkesd avatar jarily avatar kl7sn avatar laojianzi avatar lincolnzhou avatar link-duan avatar luyang950 avatar neoyeelf avatar optimistic9527 avatar qingbozhang avatar sevennt avatar shaoyuan1943 avatar shuaxindiary avatar soeluc avatar testwill avatar wujunze avatar zcong1993 avatar zhjunjun avatar zxmfke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ego's Issues

build constraints exclude all Go files

run demo with quickstart
https://ego.gocn.vip/frame/quickstart/quickstart.html

go mod is
github.com/gotomicro/[email protected]

when i want to start app
go run main.go --config=config.toml

get error

package command-line-arguments
        imports github.com/gotomicro/ego
        imports github.com/gotomicro/ego/core/util/xcolor: build constraints exclude all Go files in E:\go\pkg\mod\github.com\gotomicro\[email protected]\core\util\xcolor

switch to
github.com/gotomicro/[email protected]
this version is ok

about config

  1. Why not use viper lib to load config data source? Viper support load config from file / env /config center, watch change too
  2. Support multi data source?
  3. Support load config center data to update local config file when config center is formal, to prevent config center crash

ego user list

Welcome to use ego To know who is using it, pls append your org info as follow,
Organization:ego (Required)
Location: Shanghai, China(Required)
Contact: Email or Official website (Optional)
Purpose:use as our basic framework (Required)

Thanks again for your participation!

欢迎使用 ego,首先感谢你的使用,其次您可以参考下面的样例来提供您的信息以收集下使用场景:

  • 组织:ego(Required)
  • 地点:**上海(Required)
  • 联系方式:邮箱或官方网站(Optional)
  • 场景:作为服务端基础框架使用(Required)

再次感谢你的参与!!!

[Feature]期望支持多配置文件

Is your feature request related to a problem? Please describe.
在接入ego过程中,遇到2类场景, 在接入过程里,比较容易出错。

  1. 多配置文件,并且都比较大,多配置文件合一的过程,容易出错,不利于执行,且可读性不好。期望对问题1,支持多配置文件。
  2. 部分项目配置文件的格式不标准,在接入ego过程中,想用到component,但是component的配置,由旧配置文件读好了,在内存中。期望问题2,对主流component(eredis,egorm,egin),支持egin.LoadFromKV(map[string]interface{}),来做到指定配置值赋予。

Describe the solution you'd like
对问题1的期望解决方式:
对econf支持载入多数据源,并且允许不同文件的key重复。

预期样式:

var redisfilepath = "/xxx/xx/redis.yaml"
var db filepath = "/xx/xx/db.yaml"
var domainfilepath = "/xxx/xx/domain.yaml"
rediscfg := econf.NewFromFile(redisfilepath)
dbcfg :=econf.NewfromFile(dbfilepath)
domaincfg :=econf.NewFromFile(domainfilepath)

部分核心component优先支持, eredis,egorm,支持指定econf.Configuration来读取键值
预期样式:
eredis.LoadFromCfg(rediscfg, "userredis.scene1")

对问题2的期望解决方式:
部分核心component支持该方法,来内存赋值: egin.LoadFromKV(map[string]interface{})

Describe alternatives you've considered
对问题1的econf,写法使用多变量来承接,而不是杂糅进econf里,写成econf.Load(file1,file2,file3),主要考虑到econf中的维护关系,都是围绕单配置源,watch相关操作,在集成多文件时,容易出现不兼容问题。其次,不同的中间件,在载入配置信息时,应该显式地知道读取哪个配置文件(egin.LoadFrom(ginconfig)) ,而不是由框架静默选择。

对问题2的入参设置为map,是基于部分component的配置key,未提供可配置字段的Set方法,因为Container结构体里面的config是小写的,很多优化配置的参数,在未正确接入econf (解决问题1前)时,无法载入。

panic in handler but retrun code 200

Handler 中 panic,egin 却依然返回 200 code。

func Import(ctx *gin.Context) {
	for _, s := range something {
    	    Panic()
	}
        // 此处仍然能继续返回
	ctx.JSON(200, map[string]interface{}{"result": "ok"})
}

func  Panic(){
  panic("don't panic")
}

egin 支持https并且支持双向认证

背景:
在安全场景下,后端服务提供给第三方,或者跟网关的情况下,虽然在网关后面但是需要与第三方或者官网进行双向认证

当前情况:
egin不支持https并且支持双向认证

go 1.16 embed 特性加载配置

Is your feature request related to a problem? Please describe.

编译后可执行程序,需要配置文件,往往要把配置文件和可执行程序一起放在线上服务器,配置文件内容尤其是sql连接信息,非常敏感

Describe the solution you'd like

1.16之后,有了 embed 特性,可以在编译服务过程中过程中,就把配置打包进去, 线上真正只需要一个可执行程序

Describe alternatives you've considered

1.16之前,我们是将配置写在一个go文件里面,不是很友好

Additional context

期待更好

新版ego框架econf组件存在数据竞争问题

BUG描述
在ego初始化后注册econf.OnChange回调会出现数据竞争
另外在ego初始化后操作组件也可能出现此情况(未验证)

BUG复现方法
1.代码

package main

import (
	"github.com/gotomicro/ego"
	"github.com/gotomicro/ego/core/econf"
)

type Mysql struct {
	Dsn string
}

func main() {
	ego.New()

	econf.OnChange(func(c *econf.Configuration) {})
}

2.执行命令go run -race ./cmd/ego/main.go --config=./configs/main/config.toml
3.报错信息

==================
WARNING: DATA RACE
Write at 0x00c0001228a0 by main goroutine:
  github.com/gotomicro/ego/core/econf.(*Configuration).OnChange()
      /go/pkg/mod/github.com/gotomicro/[email protected]/core/econf/conf.go:72 +0xf3
  github.com/gotomicro/ego/core/econf.OnChange()
      /go/pkg/mod/github.com/gotomicro/[email protected]/core/econf/api.go:36 +0x32
  main.main()
      /workspaces/coreadmin/cmd/ego/main.go:15 +0x31

Previous read at 0x00c0001228a0 by goroutine 29:
  github.com/gotomicro/ego/core/econf.(*Configuration).LoadFromDataSource.func1()
      /go/pkg/mod/github.com/gotomicro/[email protected]/core/econf/conf.go:92 +0x64

Goroutine 29 (running) created at:
  github.com/gotomicro/ego/core/econf.(*Configuration).LoadFromDataSource()
      /go/pkg/mod/github.com/gotomicro/[email protected]/core/econf/conf.go:90 +0x316
  github.com/gotomicro/ego/core/econf.LoadFromDataSource()
      /go/pkg/mod/github.com/gotomicro/[email protected]/core/econf/api.go:48 +0x4a6
  github.com/gotomicro/ego.loadConfig()
      /go/pkg/mod/github.com/gotomicro/[email protected]/ego_function.go:171 +0x450
  github.com/gotomicro/ego.runSerialFuncReturnError()
      /go/pkg/mod/github.com/gotomicro/[email protected]/ego_function.go:262 +0x16bd
  github.com/gotomicro/ego.New()
      /go/pkg/mod/github.com/gotomicro/[email protected]/ego.go:124 +0x1623
  main.main()
      /workspaces/coreadmin/cmd/ego/main.go:13 +0x30
==================
Found 1 data race(s)
exit status 66

3.ego中出现异常的代码行
image

组件依赖 econf 加载配置,能不能传入自定义配置给组件呢?

例如现在的新建 egin component 代码为:

server := egin.Load("server.http").Build()

而我现在使用的一个旧项目已经在线上运行,更改 config 结构不方便,能否通过下面这种方式传入自定义配置项呢?

server := egin.Load("", egin.Config{Port: 9001, Host: "0.0.0.0"}).Build()

cron task 设计问题

Is your feature request related to a problem? Please describe.
根据当前的代码,目前ecron设计上,每个cron task配置一个config后,都会启动一个cron来运行这个job,这样代价是不是有点高?

Describe the solution you'd like
大多数业务场景下,任务会根据业务场景归类,希望这里的ecron是一个配置项目支持的是一组task的管理

Log format

Describe the bug
the value of cost key in grpc api access log should be float, but is string

To Reproduce
Steps to reproduce the behavior:

  1. launch a grpc server
  2. send grpc request
  3. check the server.grpc log

vscode 调试

ego团队,你好!
ego框架在vscode中运行,然后怎么进行vscode调试。

希望ego框架能够新增grpc-gateway功能

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 [...]
在用grpc时我用到了grpc-gateway,我目前自己写了一个grpc-gatway的ego-componet因为对ego框架部分功能不太熟,实现得不够优雅,希望ego框架官方能够增加此模块
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.

希望能够提供细粒度的监控,包括服务提供的每个接口的pct99以及依赖下游的接口(包括但不限于db与下游微服务)的pct99

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.