I
I
Ivan Soshnikov2015-05-23 23:08:12
go
Ivan Soshnikov, 2015-05-23 23:08:12

How to convert [4]uint8{0,0,0,0} to []uint8{}?

Problem writing TCP client.
It is necessary to initialize a buffer of binary data of a certain size, send it to a piece of hardware and receive a piece of data in response to a certain size.
In the general case, the task is to write a daemon that polls devices via TCP and UART. How suitable is Go for this task? I would like to migrate from python in order to divide device polling into several threads.
Here is the second day scratching my turnips: Go vs Rust

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
Tyranron, 2015-05-24
@Tyranron

With regards to the question:
Well, you should at least look at the docks, the situation is childish. Here specifically for your question.

x := [3]string{"Лайка", "Белка", "Стрелка"}
s := x[:] // a slice referencing the storage of x

With regards to the combed turnip:
IMHO, you should not do versus. And in that, and in another language, this problem is remarkably solved.
Go is very good and handy for writing daemons. Probably, we can say that in fact this is his main niche now.
Rust is more low-level, but at the same time, much more interesting and expressive than Go.
If the project is homemade and there is an interest in brainstorming about Rust, then I would choose it. If you need it quickly, easily, conveniently and understandably (not only for you), then, of course, Go would not bother.

I
index0h, 2015-05-24
@index0h

uvelichitel
You are confusing internal slice pointer and slice pointer
play.golang.org/p/F50nKYC-jr
golang.org/pkg/builtin/#pkg-variables
nil is a predeclared identifier representing the zero value for a pointer, channel, func, interface, map, or slice type.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question