Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [go]

Go is an open-source programming language, with a syntax loosely derived from C. It's statically typed, with limited dynamic typing capabilities; it also features automatic memory management, built-in concurrency primitives, variable-length arrays – called slices –, and a large standard library.

0 votes
1 answer
10 views

How validate number length in ozzo-go

im trying to use ozzo for validating a phone number with fixed lenght of 13. how can I achieve that with ozzo? here is my code: func RequestCheker(request api.User) error { return validation....
jexroid's user avatar
  • 155
-1 votes
0 answers
15 views

Does golang unit test also running main function?

I have simple learning clean architecture app written in golang. I wanna add test to my service package. I put the test file under service_test package. When i running my test, it always show error ...
Maulkariem's user avatar
0 votes
0 answers
23 views

Why the Protobuff is slower than JSON.stringify() in NodeJS?

In our system, we are trying to reduce the data transfer duration between two applications through RabbitMQ. To do so, we are doing some tests with Protobuff and Flatbuffer. According to our test, ...
anileates's user avatar
  • 128
-2 votes
0 answers
18 views

Linter Warning: struct field tag `json:email_addresses` not compatible with reflect.StructTag.Get: bad syntax for struct tag value [closed]

I have the following struct defined: type User struct { gorm.Model FirstName string `json:"first_name" gorm:"type:varchar(32); not null" binding:"required&...
s4m0k's user avatar
  • 9
0 votes
0 answers
33 views

Receiving an error when adding two req.Header elements

TL;DR: Setting two Header elements results in either an error for Content-Type if Authorization is set first, or Authorization if Content-Type is set first. I am working on a Schwab API wrapper, and I ...
sjt's user avatar
  • 11
0 votes
0 answers
35 views

"The filename, directory name, or volume label syntax is incorrect" surfaces in a complex Go app, but identical code runs in simple Go app

In a large Go applcation, I have this code snippet: fName = filepath.Join(DestPath, fName) log.Println(fName) f, err := os.Create(fName) defer f.Close() if err ...
Vector's user avatar
  • 11.4k
0 votes
0 answers
34 views

Question about error raw query string using gorm

I generate raw query like that UPDATE public.openedu_user_tokens AS t SET update_at = c.update_at, delete_at = c.delete_at, user_id = c.user_id, org_id = c.org_id, email = c.email, ...
Anoencs's user avatar
0 votes
0 answers
26 views

Problem with golang plus htmx plus javascript

I have a problem, because when I click first eg today button, then from api i get slice with titles with date:today, but when i click next or prev month and then i go back to current month, when i ...
Aleksander Janic's user avatar
1 vote
0 answers
31 views

how to pass client id and client secret from oath 2.0 redirect to call back api

i was trying to set up dropbox oauth in my app, the following is the handler for grantapi, the grant api redirects the user to dropbox authentication page its address is localhost:8089/api/grant ...
hafis's user avatar
  • 101
-5 votes
0 answers
31 views

How does context switching work in a single-threaded environment with green threads in Go? [closed]

I understand that in a single-threaded environment, meaning function should run to completion before another function can execute. However, I recently came across the concept of green threads in Go ...
Hououin_kyouma's user avatar
-3 votes
1 answer
50 views

GO Call a function which return a interger kubernetes [closed]

I have a pod.yaml, I want to retrieve a new annotation integer value, to make a sleep. So I used Go to fetch the integer after the name : new-anno. With this value, I want to return a function to make ...
esefe sgrgrz's user avatar
0 votes
2 answers
46 views

Assigning value to interface argument using DoAndReturn

I have the following method: func (r *RedisClient) GetStruct(ctx context.Context, key Key, value interface{}) (*time.Duration, error) { // stuff happens here } This method has an interface (and ...
Liam Fell's user avatar
  • 1,310
1 vote
0 answers
9 views

How to delete offset when message got consumed using franz-go?

I'm using franz-go library to implement the kafka Case want to achieve :- I want to delete the message from kafka when it get consumed using adminClient Error :- map[] request key is unknown Code func ...
Puneet Jindal's user avatar
-4 votes
0 answers
20 views

What would be idiomatic way to implement Abstract class in golang? [duplicate]

We have a code sample which is along the following lines type Foo interface { DoSome() error } type AbstractFoo struct { Foo X Y } type ConcreteFoo struct { ..... } This looks all ...
rajeshnair's user avatar
  • 1,629
1 vote
0 answers
17 views

Reading an unknown extension object from OPC UA using gopcua

I am new to OPC and was trying to read from an OPC UA server in golang using gopcua library, but I encountered the following error: StatusBadDataTypeIdUnknown (0x80110000) error. I’m reading the data ...
Hassan Raza Warraich's user avatar

15 30 50 per page
1
2 3 4 5
4903