Stack Overflow Community » Go
101 FOLLOWERS
Stack Overflow is a public platform building the definitive collection of coding questions & answers. This community is a place to get all your queries solved regarding Go, an open-source programming language.
Stack Overflow Community » Go
1h ago
I'm new to go and I have a project with the following structure
client/
user/
interface.go
impl.go
structures/
user/
requests.go
responses.go
actions/
user/
get_user.go
create_user.go
So, i have 3 packages with name 'user'. Is it OK, or I need to rename packages to userstruct, userclient, useract or smth like this? Or I need to change full structures of my code ..read more
Stack Overflow Community » Go
1h ago
I have been trying to deploy a simple image from ACR to AKS using Helm.
The Helm Templates are almost completely fresh out of the command "helm create hello":
Chart.yaml:
apiVersion: v2
name: hello
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions i ..read more
Stack Overflow Community » Go
1h ago
I am using the https://pkg.go.dev/github.com/sethvargo/go-retry package to make retry attempts on the GitHub API server from my application. The package is the simplest of the lot, that assists in making retry attempts of a web API call.
The issue that is bugging me is the RetryFunc in https://pkg.go.dev/github.com/sethvargo/go-retry#RetryFunc takes a closure of the form
type RetryFunc func(ctx context.Context) error
I have a lot of GitHub APIs wrapped around this retry logic, with varying number of arguments.
Sample code below
func retryDecision(resp *github.Response) error {
if resp.S ..read more
Stack Overflow Community » Go
2h ago
I have a memory leak in my application which use gopacket/pcap : memory consumption increases continuously when the application receives network traffic.
My code :
src := gopacket.NewPacketSource(p.parent.pcapHandle, layers.LayerTypeEthernet)
in := src.Packets()
for {
select {
case err = <-tg.IsClosingEvent():
return err
case packet := <-in:
fmt.Print(packet)
}
}
Prototype of IsClosingEvent : func (h *ThreadGroup) IsClosingEvent() <-chan error {
During my application works, tg.IsClosingEvent() is never used : it is to manage a application close event ..read more
Stack Overflow Community » Go
6h ago
I am trying to unmarshal an envoy config from JSON to Golang proto struct. The JSON has an Any field with type information. I know that protojson somehow magically determines the proto definitions in the binary. In the case below I get an error.
Error: Expected nil, but got: &errors.prefixError{s:"(line 23:46): unable to resolve \"type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog\": \"not found\""}
package play
import (
"testing"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/encoding/protojson"
listener "github.com ..read more
Stack Overflow Community » Go
6h ago
Here is my main.dart Code
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:window_manager/window_manager.dart';
import 'package:agiler/providers/auth_screen_provider.dart';
import 'package:agiler/providers/home_screen_provider.dart';
import 'package:agiler/utilities/app_strings/app_strings.dart';
import 'package:agiler/initialization_main/main_initialization.dart';
import 'dart:developer';
import 'dart:ffi' as ffi;
import 'package:ffi/ffi.dart';
import 'package:dylib/dylib.dart' as dlib;
void main() async {
WidgetsFlutterBinding.ensureInitia ..read more
Stack Overflow Community » Go
7h ago
At the Go/Helm template, we can use - for removing leading and trailing spaces.
Go document said
For this trimming, the definition of white space characters is the same as in Go: space, horizontal tab, carriage return, and newline.
{{- /* a comment with white space trimmed from preceding and following text */ -}} A comment; discarded. May contain newlines. Comments do not nest and must start and end at the delimiters, as shown here.
But I can't understand what happen when we use - in the front and the back of define and end. Because I think define and end are like kinds of a function, we d ..read more
Stack Overflow Community » Go
7h ago
When selecting a specific test to debug on VSCode , the envFile configuration parameter does not loads the configuration file with the specified env vars.
Current debug configuration :
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch File",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/microservice/main.go",
"envFile": "${workspaceFolder}/local/env/.env",
"showLog":true,
"cwd":"${workspaceFolder}"
}
]
}
When accessing v ..read more
Stack Overflow Community » Go
7h ago
I have the following tree structure for my application:
application:
ª Dockerfile
ª go.mod
ª README.md
ª
+---cmd
ª +---web
ª main.go
ª
+---pkg
ª +---config
ª ª config.go
ª ª
ª +---handlers
ª ª handlers.go
ª ª
ª +---models
ª ª templatedata.go
ª ª
ª +---render
ª render.go
ª
+---templates
ª base.layout.html
ª coffee.page.html
ª drinks.page.html
ª empty.layout.html
ª home.page.html
ª new.page.html
ª popular.page.html
ª recs.page.html ..read more
Stack Overflow Community » Go
7h ago
I would like run debug go using VSCode on Mac M2 but necessary to using go env GOARCH=amd64 bacause soruce code using library bou.ke/monkey,monkey doesn't work on arm64 (it work if set GOARCH=amd64)
https://github.com/jenkins-x/jx/issues/2081
how to run debug go using VSCode on Mac M2 using go env GOARCH=amd64 ..read more