Skip to Content
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
Explore Skills
Cloud Computing
Microsoft Azure
Amazon Web Services (AWS)
Google Cloud
Cloud Migration
Cloud Deployment
Cloud Platforms
Data Engineering
Data Warehouse
SQL
Apache Spark
Microsoft SQL Server
MySQL
Kafka
Data Lake
Streaming & Messaging
NoSQL Databases
Relational Databases
Data Science
Pandas
R
MATLAB
SAS
D3
Power BI
Tableau
Statistics
Exploratory Data Analysis
Data Visualization
AI & ML
Generative AI
Machine Learning
Artificial Intelligence (AI)
Deep Learning
Reinforcement Learning
Natural Language Processing
TensorFlow
Scikit-Learn
Hyperparameter Tuning
MLOps
Programming Languages
Java
JavaScript
Spring
Python
Go
C#
C++
C
Swift
Rust
Functional Programming
Software Architecture
Object-Oriented
Distributed Systems
Domain-Driven Design
Architectural Patterns
IT/Ops
Kubernetes
Docker
GitHub
Terraform
Continuous Delivery
Continuous Integration
Database Administration
Computer Networking
Operating Systems
IT Certifications
Security
Network Security
Application Security
Incident Response
Zero Trust Model
Disaster Recovery
Penetration Testing / Ethical Hacking
Governance
Malware
Security Architecture
Security Engineering
Security Certifications
Design
Web Design
Graphic Design
Interaction Design
Film & Video
User Experience (UX)
Design Process
Design Tools
Business
Agile
Project Management
Product Management
Marketing
Human Resources
Finance
Team Management
Business Strategy
Digital Transformation
Organizational Leadership
Soft Skills
Professional Communication
Emotional Intelligence
Presentation Skills
Innovation
Critical Thinking
Public Speaking
Collaboration
Personal Productivity
Confidence / Motivation
Features
All features
Verifiable skills
AI Academy
Courses
Certifications
Interactive learning
Live events
Superstreams
Answers
Insights reporting
Radar Blog
Buy Courses
Plans
Sign In
Try Now
O'Reilly Platform
book
러닝 Go : Go 개발자처럼 생각하는 방법
by
존 보드너
,
윤대석
February 2022
Beginner to intermediate
452 pages
10h 48m
Korean
Hanbit Media, Inc.
Content preview from
러닝 Go : Go 개발자처럼 생각하는 방법
298
러닝 Go
result, err = doSomeWork()
close(done)
}()
select {
case <-done:
return result, err
case <-time.After(2 * time.Second):
return 0, errors.New(“work timed out”)
}
}
Go
에서 작업에 걸리는 시간을 제한해야 할 때마다 이런 패턴의 변형을 볼 수 있다. 두
case
를
select
로 선택할 수 있다. 첫 번째
case
는 앞서 보았던
done
채널 패턴의 장점을 가진다.
result
와
err
에 값을 할당하고
done
채널을 닫기 위해 클로저를 고루틴으로 사용했다.
done
채널이 먼저 닫히면,
done
으로부터 성공적으로 읽게 되고 값들은 반환된다.
두 번째 채널은
time
패키지에 있는
After
함수에서 반환된다.
이것은
지정된
time
.
Duration
이 지나면 값이 쓰여질 것이다.
(
11
.
2
절 ‘시간’에서
time
패키지에 관해 다루어 보
자.
)
doSomeWork
가 끝나기 전에 해당 값이 읽힌다면,
timeLimit
은 타임아웃 오류를 반환한다.
NOTE
_
고루틴이 처리를 끝내기 전에
timeLimit
을 종료하면, 고루틴은 계속 실행을 한다. 이는 (결국) 반
환하는 결과에 대해 아무것도 하지 않는다. 더 이상 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial
You might also like
효율적인 리눅스 명령어 사용의 기술
Daniel J Barrett
코드로 인프라 관리하기(2판)
키프 모리스
코드로 인프라 관리하기: 효율적인 인프라 관리를 위한 자동화 방법
강재준
자바 마이크로서비스를 활용한 SRE : 기업에서 신뢰할 수 있는 마이크로서비스를 위한 패턴
조너선 슈나이더
Publisher Resources
ISBN: 9791162245309