K
K
Kagtaviy2016-05-13 08:39:07
go
Kagtaviy, 2016-05-13 08:39:07

Why is the "net/context" package needed?

Hello, sorry for such a stupid question.
Please explain what kind of package it is and in what cases it should be used?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
spotifi, 2016-05-13
@Kagtaviy

This is a rather complex package to understand.
Not intuitive.
Here it is very well described, with extended comments - and why at all:
https://habrahabr.ru/post/269299/

N
Nikita, 2016-05-13
@bitver

Type your question into Google, it helps.
Reading the documentation is sometimes helpful, you know?
https://godoc.org/golang.org/x/net/context
https://blog.golang.org/context

A
alex08, 2016-06-17
@alex08

Here is a good translation: poetofcode.ru/2016/01/09/patternyu-parallelizma-v-...

I
ilyasvetozar, 2017-11-17
@ilyasvetozar

This is a type of container or buffer for storing intermediate data.
The built-in Go server processes requests in parallel. Therefore, for example, variables external to a function can be used simultaneously by several threads. If there is a chain of functions, then it is necessary to pass data as an argument, which is inconvenient.
Frameworks offer their own contexts (containers), now since version 1.7 the context is available in the standard library.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question