mirror of
				https://github.com/openimsdk/open-im-server.git
				synced 2025-10-26 21:22:16 +08:00 
			
		
		
		
	style: Formatting code make lint path
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
		
							parent
							
								
									08ccf7c318
								
							
						
					
					
						commit
						2e08746f3f
					
				| @ -17,6 +17,8 @@ | |||||||
| set -e | set -e | ||||||
| set -o pipefail | set -o pipefail | ||||||
| 
 | 
 | ||||||
|  | . $(dirname ${BASH_SOURCE})/lib/init.sh | ||||||
|  | 
 | ||||||
| trap 'echo "Script interrupted."; exit 1' INT | trap 'echo "Script interrupted."; exit 1' INT | ||||||
| 
 | 
 | ||||||
| # Function for colored echo | # Function for colored echo | ||||||
| @ -26,24 +28,6 @@ function color_echo() { | |||||||
|     echo -e "${COLOR}===> $* ${COLOR_SUFFIX}" |     echo -e "${COLOR}===> $* ${COLOR_SUFFIX}" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| # Color definitions |  | ||||||
| function openim_color() { |  | ||||||
|     COLOR_SUFFIX="\033[0m"      # End all colors and special effects |  | ||||||
| 
 |  | ||||||
|     BLACK_PREFIX="\033[30m"     # Black prefix |  | ||||||
|     RED_PREFIX="\033[31m"       # Red prefix |  | ||||||
|     GREEN_PREFIX="\033[32m"     # Green prefix |  | ||||||
|     YELLOW_PREFIX="\033[33m"    # Yellow prefix |  | ||||||
|     BLUE_PREFIX="\033[34m"      # Blue prefix |  | ||||||
|     SKY_BLUE_PREFIX="\033[36m"  # Sky blue prefix |  | ||||||
|     WHITE_PREFIX="\033[37m"     # White prefix |  | ||||||
|     BOLD_PREFIX="\033[1m"       # Bold prefix |  | ||||||
|     UNDERLINE_PREFIX="\033[4m"  # Underline prefix |  | ||||||
|     ITALIC_PREFIX="\033[3m"     # Italic prefix |  | ||||||
| 
 |  | ||||||
|     CYAN_PREFIX="\033[0;36m"     # Cyan prefix |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| function print_with_delay() { | function print_with_delay() { | ||||||
|   text="$1" |   text="$1" | ||||||
|   delay="$2" |   delay="$2" | ||||||
| @ -68,6 +52,7 @@ function print_progress() { | |||||||
|   done |   done | ||||||
|   printf "]${COLOR_SUFFIX}\n" |   printf "]${COLOR_SUFFIX}\n" | ||||||
| } | } | ||||||
|  | 
 | ||||||
| function openim_logo() { | function openim_logo() { | ||||||
|     # Set text color to cyan for header and URL |     # Set text color to cyan for header and URL | ||||||
|     echo -e "\033[0;36m" |     echo -e "\033[0;36m" | ||||||
|  | |||||||
| @ -13,10 +13,15 @@ | |||||||
| # See the License for the specific language governing permissions and | # See the License for the specific language governing permissions and | ||||||
| # limitations under the License. | # limitations under the License. | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| clear | clear | ||||||
| . $(dirname ${BASH_SOURCE})/lib/util.sh | . $(dirname ${BASH_SOURCE})/lib/util.sh | ||||||
| 
 | 
 | ||||||
|  | openim::util::desc "========> Welcome to the OpenIM Demo" | ||||||
|  | openim::util::desc "========> We'll help you get started with OpenIM quickly" | ||||||
|  | openim::util::desc "========> Press Enter to continue...." | ||||||
|  | openim::util::run "make advertise" | ||||||
|  | clear | ||||||
|  | 
 | ||||||
| openim::util::desc "You can learn a lot about automation using make help" | openim::util::desc "You can learn a lot about automation using make help" | ||||||
| openim::util::run "make help" | openim::util::run "make help" | ||||||
| clear | clear | ||||||
| @ -25,18 +30,30 @@ openim::util::desc "You can learn a lot about automation using make help-all" | |||||||
| openim::util::run "make help-all" | openim::util::run "make help-all" | ||||||
| clear | clear | ||||||
| 
 | 
 | ||||||
| openim::util::desc "Run tidy" | openim::util::desc "How did we teach you how to build OpenIM" | ||||||
|  | openim::util::desc "A full build startup check" | ||||||
|  | openim::util::run "make all" | ||||||
|  | 
 | ||||||
|  | openim::util::desc "Build one OpenIM binary" | ||||||
|  | openim::util::desc "BINS: openim-api openim-cmdutils openim-crontask openim-msggateway openim-msgtransfer openim-push openim-rpc changelog infra ncpu yamlfmt" | ||||||
|  | openim::util::run "make build BINS=openim-api" | ||||||
|  | 
 | ||||||
|  | openim::util::desc "Build binaries for all platforms" | ||||||
|  | openim::util::run "make multiarch -j BINS=openim-api PLATFORMS='linux_arm64 linux_amd64' " | ||||||
|  | 
 | ||||||
|  | openim::util::desc "If you wish to use dlv for debugging, either binary or process" | ||||||
|  | openim::util::desc "You need to enable debug mode" | ||||||
|  | openim::util::run "make build BINS=openim-api DEBUG=1" | ||||||
|  | clear | ||||||
|  | 
 | ||||||
|  | openim::util::desc "Run tidy to format and fix imports" | ||||||
| openim::util::run "make tidy" | openim::util::run "make tidy" | ||||||
| clear | clear | ||||||
| 
 | 
 | ||||||
| openim::util::desc "Vendor go.mod" | openim::util::desc "Vendor go.mod dependencies" | ||||||
| openim::util::run "make vendor" | openim::util::run "make vendor" | ||||||
| clear | clear | ||||||
| 
 | 
 | ||||||
| openim::util::desc "Code style: fmt, vet, lint" |  | ||||||
| openim::util::run "make style" |  | ||||||
| clear |  | ||||||
| 
 |  | ||||||
| openim::util::desc "Run unit tests" | openim::util::desc "Run unit tests" | ||||||
| openim::util::run "make test" | openim::util::run "make test" | ||||||
| clear | clear | ||||||
| @ -49,7 +66,7 @@ openim::util::desc "Check for updates to go.mod dependencies" | |||||||
| openim::util::run "make updates" | openim::util::run "make updates" | ||||||
| clear | clear | ||||||
| 
 | 
 | ||||||
| openim::util::desc "Clean" | openim::util::desc "Clean all generated files" | ||||||
| openim::util::run "make clean" | openim::util::run "make clean" | ||||||
| clear | clear | ||||||
| 
 | 
 | ||||||
| @ -57,14 +74,6 @@ openim::util::desc "Generate all necessary files" | |||||||
| openim::util::run "make gen" | openim::util::run "make gen" | ||||||
| clear | clear | ||||||
| 
 | 
 | ||||||
| openim::util::desc "Generate swagger document" |  | ||||||
| openim::util::run "make swagger" |  | ||||||
| clear |  | ||||||
| 
 |  | ||||||
| openim::util::desc "Serve swagger spec and docs" |  | ||||||
| openim::util::run "make serve-swagger" |  | ||||||
| clear |  | ||||||
| 
 |  | ||||||
| openim::util::desc "Verify the license headers for all files" | openim::util::desc "Verify the license headers for all files" | ||||||
| openim::util::run "make verify-copyright" | openim::util::run "make verify-copyright" | ||||||
| clear | clear | ||||||
| @ -72,15 +81,3 @@ clear | |||||||
| openim::util::desc "Add copyright" | openim::util::desc "Add copyright" | ||||||
| openim::util::run "make add-copyright" | openim::util::run "make add-copyright" | ||||||
| clear | clear | ||||||
| 
 |  | ||||||
| openim::util::desc "Project introduction, become a contributor" |  | ||||||
| openim::util::run "make advertise" |  | ||||||
| clear |  | ||||||
| 
 |  | ||||||
| openim::util::desc "Release the project" |  | ||||||
| openim::util::run "make release" |  | ||||||
| clear |  | ||||||
| 
 |  | ||||||
| openim::util::desc "Run demo" |  | ||||||
| openim::util::run "make demo" |  | ||||||
| clear |  | ||||||
|  | |||||||
| @ -36,21 +36,6 @@ COLOR_BGREEN='\033[42m';COLOR_BYELLOW='\033[43m'; | |||||||
| COLOR_BBLUE='\033[44m';COLOR_BMAGENTA='\033[45m'; | COLOR_BBLUE='\033[44m';COLOR_BMAGENTA='\033[45m'; | ||||||
| COLOR_BCYAN='\033[46m';COLOR_BWHITE='\033[47m'; | COLOR_BCYAN='\033[46m';COLOR_BWHITE='\033[47m'; | ||||||
| 
 | 
 | ||||||
| # --- Color definitions ---  |  | ||||||
| COLOR_SUFFIX="\033[0m"      # End all colors and special effects |  | ||||||
| BLACK_PREFIX="\033[30m"     # Black prefix |  | ||||||
| RED_PREFIX="\033[31m"       # Red prefix |  | ||||||
| GREEN_PREFIX="\033[32m"     # Green prefix |  | ||||||
| YELLOW_PREFIX="\033[33m"    # Yellow prefix |  | ||||||
| BLUE_PREFIX="\033[34m"      # Blue prefix |  | ||||||
| SKY_BLUE_PREFIX="\033[36m"  # Sky blue prefix |  | ||||||
| WHITE_PREFIX="\033[37m"     # White prefix |  | ||||||
| BOLD_PREFIX="\033[1m"       # Bold prefix |  | ||||||
| UNDERLINE_PREFIX="\033[4m"  # Underline prefix |  | ||||||
| ITALIC_PREFIX="\033[3m"     # Italic prefix |  | ||||||
| BRIGHT_GREEN_PREFIX='\033[1;32m' # Bright green prefix |  | ||||||
| CYAN_PREFIX="\033[0;36m"     # Cyan prefix |  | ||||||
| 
 |  | ||||||
| # --- make demo (run demo) --- | # --- make demo (run demo) --- | ||||||
| reset=$(tput sgr0) | reset=$(tput sgr0) | ||||||
| bold=$(tput bold) | bold=$(tput bold) | ||||||
| @ -61,6 +46,25 @@ yellow=$(tput bold; tput setaf 3) | |||||||
| blue=$(tput bold; tput setaf 6) | blue=$(tput bold; tput setaf 6) | ||||||
| timeout=$(if [ "$(uname)" == "Darwin" ]; then echo "1"; else echo "0.1"; fi) | timeout=$(if [ "$(uname)" == "Darwin" ]; then echo "1"; else echo "0.1"; fi) | ||||||
| 
 | 
 | ||||||
|  | # --- Color definitions ---  | ||||||
|  | # Color definitions | ||||||
|  | function openim_color() { | ||||||
|  |     COLOR_SUFFIX="\033[0m"      # End all colors and special effects | ||||||
|  | 
 | ||||||
|  |     BLACK_PREFIX="\033[30m"     # Black prefix | ||||||
|  |     RED_PREFIX="\033[31m"       # Red prefix | ||||||
|  |     GREEN_PREFIX="\033[32m"     # Green prefix | ||||||
|  |     YELLOW_PREFIX="\033[33m"    # Yellow prefix | ||||||
|  |     BLUE_PREFIX="\033[34m"      # Blue prefix | ||||||
|  |     SKY_BLUE_PREFIX="\033[36m"  # Sky blue prefix | ||||||
|  |     WHITE_PREFIX="\033[37m"     # White prefix | ||||||
|  |     BOLD_PREFIX="\033[1m"       # Bold prefix | ||||||
|  |     UNDERLINE_PREFIX="\033[4m"  # Underline prefix | ||||||
|  |     ITALIC_PREFIX="\033[3m"     # Italic prefix | ||||||
|  | 
 | ||||||
|  |     CYAN_PREFIX="\033[0;36m"     # Cyan prefix | ||||||
|  | } | ||||||
|  | 
 | ||||||
| # --- helper functions for logs --- | # --- helper functions for logs --- | ||||||
| function info() | function info() | ||||||
| { | { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user