update
							parent
							
								
									ebf2951ea3
								
							
						
					
					
						commit
						0a47f12905
					
				| 
						 | 
				
			
			@ -29,6 +29,7 @@ func New(s *server.Service) *Service {
 | 
			
		|||
 | 
			
		||||
func (srv Service) GetName() string           { return "auth.Service" }
 | 
			
		||||
func (srv Service) GetDependencies() []string { return []string{"server.Service", "auth.Auth"} }
 | 
			
		||||
func (srv Service) IsService() bool           { return true }
 | 
			
		||||
 | 
			
		||||
func (srv Service) Init() error {
 | 
			
		||||
	srv.Logger = log.With().Str("mod", "auth").Str("service", "auth.Service").Logger()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,6 +13,8 @@ type Service struct {
 | 
			
		|||
 | 
			
		||||
func (srv Service) GetName() string           { return "history.Service" }
 | 
			
		||||
func (srv Service) IsService() bool           { return true }
 | 
			
		||||
func (srv Service) GetDependencies() []string { return []string{"server.Service"} }
 | 
			
		||||
 | 
			
		||||
func (srv Service) Init() error {
 | 
			
		||||
	PROD = viper.GetBool("prod")
 | 
			
		||||
	l := log.With().Str("mod", "history").
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,6 +36,9 @@ func CallerMod(depth int) (mod, file string) {
 | 
			
		|||
				break
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if f[i] == '@' {
 | 
			
		||||
			ptr = i
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,3 +20,25 @@ func TestCallerMod(t *testing.T) {
 | 
			
		|||
func TestCaller(t *testing.T) {
 | 
			
		||||
	fmt.Println(Caller(1))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestStringer(t *testing.T) {
 | 
			
		||||
	f := "test/cbox@v0.0.0-20211216161916-9173e9f37ab9/service.go"
 | 
			
		||||
	ptr := 0
 | 
			
		||||
	file := ""
 | 
			
		||||
	mod := ""
 | 
			
		||||
	for i := len(f) - 1; i > 0; i-- {
 | 
			
		||||
		if f[i] == '/' {
 | 
			
		||||
			if ptr == 0 {
 | 
			
		||||
				file = f[i+1:]
 | 
			
		||||
				ptr = i
 | 
			
		||||
			} else {
 | 
			
		||||
				mod = f[i+1 : ptr]
 | 
			
		||||
				break
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if f[i] == '@' {
 | 
			
		||||
			ptr = i
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	fmt.Println(mod, file)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue