티스토리 뷰
delete는 builtin 함수로 아래와 같이 나와 있는데 no-op가 궁금해서 찾아봤다.
// The delete built-in function deletes the element with the specified key
// (m[key]) from the map. If m is nil or there is no such element, delete
// is a no-op.
func delete(m map[Type]Type1, key Type)
Unnecessary guard around call to delete
아래와 같이 map에 key가 있는지 채크하고 있으면 지우는 코드를 짰을 때 그렇게 할 필요 없다고 staticcheck에서 알려준다.
sampleMaps := []map[string]int
for _, sampleMap := range sampleMaps {
if _, ok := sampleMap["wow"]; ok {
delete(sampleMap, "wow")
}
}
No Operation
컴퓨터 과학에서 NOP 또는 NOOP(No Operation)은 어셈블리어의 명령, 프로그래밍 언어의 문, 컴퓨터 프로토콜 명령의 하나로, 아무 일도 하지 않는다 - wiki
명령어 수행부분에서 CPU에게 잠시 쉬어가도록 지정하는 것
언어별 nop
C언어
세미콜론(;) 혹은 빈 블럭({})
jQuery
jQuery.noop() 함수
Perl
ellipis 구문(...)
Python
pass 구문
Reference
반응형
'Programming' 카테고리의 다른 글
Golang 공부 중 (0) | 2021.11.25 |
---|---|
Generic 과 Boxing&Unboxing (0) | 2021.11.24 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- QUIC
- 창업
- go
- 덕타이핑
- Network
- k8s
- thetextbook
- cka
- HTTP/3
- http
- inflearn
- no-op
- GitHub
- database
- HTTP/2
- gitignore
- pytest
- docker-compose
- MSA
- 프리온보딩
- buildkit
- Git
- Isolate level
- 위코드
- direnv
- Python
- 원티드
- Complier
- user-agent
- web_server
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함