refactor(cmd/joj3): use filepath.Join
This commit is contained in:
		
							parent
							
								
									34f1cbc711
								
							
						
					
					
						commit
						028fd11ab5
					
				|  | @ -226,8 +226,7 @@ func parseMsg(confRoot, confName, msg, tag string) ( | ||||||
| 	} | 	} | ||||||
| 	slog.Info("conventional commit", "commit", conventionalCommit) | 	slog.Info("conventional commit", "commit", conventionalCommit) | ||||||
| 	confRoot = filepath.Clean(confRoot) | 	confRoot = filepath.Clean(confRoot) | ||||||
| 	confPath = filepath.Clean(fmt.Sprintf("%s/%s/%s", | 	confPath = filepath.Join(confRoot, conventionalCommit.Scope, confName) | ||||||
| 		confRoot, conventionalCommit.Scope, confName)) |  | ||||||
| 	relPath, err := filepath.Rel(confRoot, confPath) | 	relPath, err := filepath.Rel(confRoot, confPath) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return | 		return | ||||||
|  | @ -289,8 +288,7 @@ func GetConfPath(confRoot, confName, fallbackConfName, msg, tag string) ( | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		slog.Error("parse msg", "error", err) | 		slog.Error("parse msg", "error", err) | ||||||
| 		// fallback to conf file in conf root on parse error
 | 		// fallback to conf file in conf root on parse error
 | ||||||
| 		confPath = filepath.Clean( | 		confPath = filepath.Join(confRoot, fallbackConfName) | ||||||
| 			fmt.Sprintf("%s/%s", confRoot, fallbackConfName)) |  | ||||||
| 		slog.Info("fallback to conf", "path", confPath) | 		slog.Info("fallback to conf", "path", confPath) | ||||||
| 	} | 	} | ||||||
| 	confStat, err = os.Stat(confPath) | 	confStat, err = os.Stat(confPath) | ||||||
|  | @ -300,8 +298,7 @@ func GetConfPath(confRoot, confName, fallbackConfName, msg, tag string) ( | ||||||
| 		} | 		} | ||||||
| 		slog.Error("stat conf", "error", err) | 		slog.Error("stat conf", "error", err) | ||||||
| 		// fallback to conf file in conf root on conf not exist
 | 		// fallback to conf file in conf root on conf not exist
 | ||||||
| 		confPath = filepath.Clean( | 		confPath = filepath.Join(confRoot, fallbackConfName) | ||||||
| 			fmt.Sprintf("%s/%s", confRoot, fallbackConfName)) |  | ||||||
| 		slog.Info("fallback to conf", "path", confPath) | 		slog.Info("fallback to conf", "path", confPath) | ||||||
| 		confStat, err = os.Stat(confPath) | 		confStat, err = os.Stat(confPath) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user