Issue I have seen multiple applications write their data first to buffer, then writing that buffer to socket and not just directly to socket. I have two questions: Why is that? If writing straight to socket is reasonable, then: How
Continue readinggolang ssh write backspace to stdin
Issue I am writing an ssh client to parse the configuration of a switch. This is not an interactive client. In some cases, I need to erase part of the previous typed command. If I was using PuTTY, I would
Continue readingHow to access below json values in go fiber?
Issue This is the code I wrote. When I used token.Claims method it returns below result. And I need to access email value also for check whether who is the user. When I used token.Claims.Email it throws an error. func
Continue readinghow do i create a post request like this in golang
Issue Hi guys a have a question about POST REQUEST I have a some python code like this data = { "name": "Frank", "age": 21, "nationality": ["Britan"], } r = requests.post(‘somesite’, json=data) How i can make a POST requst similar
Continue readingPSQL queries creating multiple select queries based on condition to filter out values
Issue WITH final AS ( SELECT ‘a’ AS gname, ‘b’ AS pname, ‘c’ AS name, 1 AS gid, 2 AS pid, 3 AS did, 3 AS inp UNION SELECT ‘a1’ AS gname, ‘b1’ AS pname, ‘c1’ AS name, 11 AS
Continue readingImport go module in project to another module in the same project
Issue I have the following project structure: . ├── daos │ ├── daos.go │ ├── daos.iml │ ├── go.mod │ └── go.sum ├── entities │ ├── entities │ │ └── pets.go │ ├── entities.iml │ └── go.mod └── pkg.iml I
Continue readingGolang lib/pg can't connect to postgres
Issue I have such code: package main import ( “database/sql” “fmt” “log” _ “github.com/lib/pq” ) func main() { db, err := sql.Open(“postgres”, “user=postgres dbname=vagrant sslmode=disable”) if err != nil { log.Fatal(err) } rows, err := db.Query(“SELECT 3+5”) if err !=
Continue readingHow to fix golang too many arguments error
Issue i am using following code… package main import ( “fmt” ) type traingle interface { area() int } type details struct { height int base int } func (a details) area() int { s := a.height + a.base fmt.Println(“the
Continue readingReading data just written to a temp file
Issue NOTE: Someone just (June 2022) marked that this question duplicates a question that is actually asked later (i.e. this question came first). This question was resolved over a year ago with the proper answer checked. Don’t know why someone
Continue readingPointers vs. values in parameters and return values
Issue In Go there are various ways to return a struct value or slice thereof. For individual ones I’ve seen: type MyStruct struct { Val int } func myfunc() MyStruct { return MyStruct{Val: 1} } func myfunc() *MyStruct { return
Continue reading