ProgrammingLang 119

[javascript] 변수 형식 정리(var, let ,const)

개요 var, let, 그리고 const는 JavaScript (및 Node.js)에서 변수를 선언할 때 사용하는 키워드들입니다. 이들의 주요 차이점을 아래에 정리하였습니다: Scope (범위): var Function scope입니다. 즉, 변수는 선언된 함수 내에서 액세스할 수 있습니다. 함수 외부에서 선언된 경우 전역 범위를 갖습니다. let과 const Block scope입니다. 즉, 중괄호 {} (예: if 문, for 루프 등) 내에서 선언된 변수는 해당 블록 내에서만 액세스할 수 있습니다. Reassignment (재할당): - var와 let: 변수에 새로운 값을 재할당할 수 있습니다. - const: 한 번 값을 할당하면 재할당할 수 없습니다. 그러나 const로 선언된 객체의 프로퍼티..

[React] Hook- array useState 관리

개요 React Hook 에서 사용되는 useState의 관리 방법을 정리 합니다. useState가 array 인경우 추가 https://bobbyhadz.com/blog/react-push-to-state-array How to push an Element into a state Array in React | bobbyhadz Use the spread syntax to push an element to a state array in React, e.g. `setNames(current => [...current, 'New'])`. The spread syntax (...) will unpack the existing elements of the state array into a new array w..

[go] vscode Error 및 Warning

개요 vscode에서 코딩시 발생하는 오류들을 정리 합니다. (ST1017) Yoda conditions don't use Yoda conditions (ST1017) go-staticcheck https://knowthecode.io/yoda-conditions-yoda-not-yoda Yoda Conditions: To Yoda or Not to Yoda - Know the Code Tonya explains the Yoda conditions programming style. She discusses its intent and the problem it seeks to solve. A handy guide and litmus test are included to help you decide when..

ProgrammingLang/Go 2023.02.02

[go] go mod vendor 사용법

개요 go mod vendor의 사용법을 알아보겠습니다. go mod vendor 필요 성 go에서는 1.13부터 module이라는 기능을 이용하여 package의 의존성을 자동으로 관리를 해줍니다. 그러나 여기서 하나의 문제점이 발생을 합니다. 그것은 go module을 사용하기 위해서는 항상 internet에 연결이 되어있어야 한다는 것입니다. 하지만 일반적으로 제품 개발 시는 보안을 위해서 폐쇠망에서 build를 합니다. 그러면 go module을 통해서 package를 다운로드할 수가 없습니다. 그래서 필요한 기능이 다운로드한 package에서 compile시 필요한 파일만 보관하는 기능인 go module의 vendor 기능입니다. 우선 간단한 테스트를 위해서 logrus를 사용하는 packag..

ProgrammingLang/Go 2023.01.31

[go] 내부 module 및 package 만들기

개요 이전 post([go] 1. downloading 가능한 module 및 package 만들기)에서 download가능한 module을 만들어 보았습니다. 그러나 program 을 개발 하다보면 외부에 노출 되면 안되는 module들도 많이 개발합니다. 그러면 이러한 module을 어떻게 만들면 되는지 알아보겠습니다. 참조 : https://go.dev/doc/tutorial/call-module-code 절차 1. 내부 모듈 생성 (inner_hello) 2. 내부 모듈 경로 설정 3. main package에서 호출 내부 모듈 생성 (inner) 내부 모듈은 main package directory에서 생성을 합니다. 1. inner 생성 #mkdir inner 2. inner_hello mod..

ProgrammingLang/Go 2023.01.20

[go] downloading 가능한 module 및 package 만들기

개요 go 1.19 기준에서 프로그램을 가끔 만들면 사용자 module 를 만들어야 할 때가 매우 많이 생깁니다. 그런데 항상 module 만드는 방법을 까먹습니다. 우선 첫 번째 post에서 download가능한 module을 만들어 볼것 입니다. 참고로, 모든 정보는 https://go.dev/ 에서 가져왔습니다. 알고 싶은 것 1. 나만의 module를 만드는 순서 필요한 사전 지식 - module과 package의 관계 - module 용도 - package 용도 module과 package의 관계 https://go.dev/doc/tutorial/create-module Go 코드는 package로 그룹화되고 package는 module로 그룹화됩니다. 그래서 나만의 module을 만들때는 mo..

ProgrammingLang/Go 2023.01.19

[go] 개발에 도움되는 오픈소스

1. cli 개발에 도움주는 패키지 각종 옵션 및 서브 명령어를 쉽게 사용 할 수 있도록 도와 줍니다. https://cli.urfave.org/ Welcome - urfave/cli Welcome to urfave/cli urfave/cli is a simple, fast, and fun package for building command line apps in Go. The goal is to enable developers to write fast and distributable command line applications in an expressive way. These are the guides for each major s cli.urfave.org

ProgrammingLang/Go 2023.01.18

[C++개발자되기] 32. STL Container 실무

개요 container의관련된 모든것을 실무에 필요한 순서대로 알아보겠습니다. Container의 종류 아래 site에 잘 정리되어 있습니다. https://cplusplus.com/reference/stl/ https://cplusplus.com/reference/stl/ cplusplus.com Container별 성능 https://users.cs.northwestern.edu/~riesbeck/programming/c++/stl-summary.html EECS 311: STL Containers This is a brief summary of the containers in the Standard Template Library. It deliberately sacrifices completenes..

ProgrammingLang/c++ 2022.12.28