반응형
작성일: 2024년 1월 23일

 

 

Ubuntu OS가 설치된 장비에 로그인하다보면 아래와 같이 'cannot change locale (en_US.UTF-8)' 에러 메시지가 출력되는가 있다.

 

Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-87-generic x86_64)
Last login: Tue Jan 23 15:12:32 2024 from ...
-bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

 

 

아래와 같이 locales 패키지 설치하고, en_US.UTF-8 로케일 데이터를 생성하면 해결 !!

$ apt install locales
... 중간 생략 ...
##
## English locale 생성하기
##
$ locale-gen en_US.UTF-8
Generating locales (this might take a while)...
en_US.UTF-8... done
Generation complete.
##
## 한글(Korean) locale 생성하기
##
$ locale-gen ko_KR.UTF-8

 

 


 

반응형

처음으로 golang builder를 설치하고, App 개발을 시작하려면 App 개발을 위한 최상위 폴더를 생성해야 한다.

그리고 그 최상위 폴더에서 아래와 같이 초기화 작업을 해야 한다.

 

$ go mod init andrew.space/myapp
# 위 명령에 대한 에러가 없다면, 아래의 명령을 수행한다.
# .go source code를 수정했다면 아래 명령을 수행할 것을 권한다.
# 왜냐고? .go에서 사용된 pkg 파일을 자동으로 찾아서 download해주기 때문이다.
$ go mod tidy

 

Go 언어 예제를 작성한다.

 

package main
import "fmt"
func main() {
if 7%2 == 0 {
fmt.Println("7 is even")
} else {
fmt.Println("7 is odd")
}
if 8%4 == 0 {
fmt.Println("8 is divisible by 4")
}
if num := 9; num < 0 {
fmt.Println(num, "is negative")
} else if num < 10 {
fmt.Println(num, "has 1 digit")
} else {
fmt.Println(num, "has multiple digits")
}
}

 

위 예제 코드를 빌드한다.

 

$ go mod tidy
$ go build
$ ls
go.mod main.go myapp*
$ ./myapp
7 is odd
8 is divisible by 4
9 has 1 digit
$

+ Recent posts