Training for Golang (go language)
Other
8621
649
3304

I want to learn go, can some give me some suggest?

How to use the REPL mode in the Golang language

"github.com/GoesToEleven/GolangTraining/47_templates/04_template_csv-parse/parse"
"github.com/GoesToEleven/GolangTraining/56_twitter/18_abstract-API-Model/api"
"github.com/GoesToEleven/GolangTraining/56_twitter/19_abstract-API-Model_AE-fix/Model"
"github.com/GoesToEleven/GolangTraining/56_twitter/19_abstract-API-Model_AE-fix/API"
"github.com/GoesToEleven/GolangTraining/56_twitter/19_abstract-API-Model_AE-fix/Memcache"

Without the go.mod an IDE would show errors in a file where modules are used, e.g. 02_package/main/main.go. Why not add a go.mod with just one line?

module github.com/GoesToEleven/GolangTraining

A readme seems like the bare minimum.

Fam pic.md

👋 Hello, we've received a report for a potential critical severity security issue in your repository.

Next Steps

1️⃣ Visit https://huntr.dev/bounties/1-other-GoesToEleven/GolangTraining for more advisory information.

2️⃣ Sign-up to validate or speak to the researcher for more assistance.

3️⃣ Propose a patch or outsource it to our community.


Confused or need more help?

  • Join us on our Discord and a member of our team will be happy to help! 🤗

  • Speak to a member of our team: @JamieSlome


This issue was automatically generated by huntr.dev - a bug bounty board for securing open source code.

Problem Description : There is dll( A1.dll- compiled in C++) in which a function is defined as
EXPORT void S3(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow){}

A1.dll
`// dllmain.cpp : Defines the entry point for the DLL application.
#include "pch.h"
#include
//#include

#define EXPORT extern "C" __declspec(dllexport)

EXPORT void S3(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow)
{
MessageBox(NULL, TEXT("Hello World"),
TEXT("In a DLL"), MB_OK);
}
**I want to load this DLL using GO lang. For this I am writing below program:**package main

import (
"fmt"
"syscall"
"golang.org/x/sys/windows"
)

func main() {
dll, err := syscall.LoadDLL("A1.dll")
proc, err := dll.FindProc("S3")
_, _, dllError := proc.Call()
fmt.Println("calling S3")
fmt.Printf("Error, err: %s\n", dllError)
fmt.Printf("Error, err: %s\n", err)
}`

This is not working. Also I am not able to understand that here how to pass the parameter in call function according to function S3 definition. Could anybody help me in understanding this issue?

can't load package: package github.com/GoesToEleven/GolangTraining: no Go files in go/src/github.com/GoesToEleven/GolangTraining

import "fmt' direcly lose when i save it

I want to add the effect of CSS file in GO code. HTML is added to it. Can somebody say how to add CSS file.

I want to design a webpage using Go using HTML script. But I am quite unsure whether to use the HTML script directly to the Go source code or whether create a index.html in the similar directory. Can someone help me out with this.

After printing the string program panics and terminate.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x11eb2f0]

goroutine 1 [running]:
main.main()
	<path>/main.go:21 +0x160

Hey Todd,

Great stuff on these Udemy vids and code, I'm learning a lot. One thing I noticed however was the code here uses a Sleep in main() to wait for the goroutines to finish. I'm fine with using Sleep for testing deadlocks and race conditions but I modified this to not used a Sleep and use either a WaitGroup or boolean channel semaphores. Ran into issues and couldn't understand with such a simple example why trying to implement these schemes failed and the Sleep would work. Finally realized the goroutine in the infinite loop just dies when the main thread is finished by the end of the Sleep.

I've attached a txt file of the main.go file since I can't attach *.go types. It's got code for using for loop or channel range and WaitGroup or semaphores. One thing I did find out while testing and not sure if you mentioned this in your videos or not but if you used a channel range YOU MUST EXPLICITLY CLOSE THE CHANNEL or it will hang at the range loop.

Somewhere I read that the channels don't consume system resources like a network connection or a file open so unless they are being consumed through a channel/range loop it's not always necessary to handle closing them, they just get eligible for garbage collection when going out of scope and having no references.

Hopefully, this makes sense and may provide a little cleaner implementation should someone else try to do what I did.

Thanks,

Howard

main.txt

Todd,
In the changeMe function of 04_string-pointer/main.go, you seem to be using the memory allocation for a string of 4 characters ("Todd") to store a string of 5 characters ("Rocky").
Wouldn't the changeMe function be causing memory corruption issues?
Thanks!

fmt.Println(z) // 0x82023c080 fmt.Println(*z) // Todd *z = "Rocky" fmt.Println(z) // 0x82023c080 fmt.Println(*z) // Rocky

The Google Cloud API client libraries for Go are making some breaking changes:

  • The import paths are changing from google.golang.org/cloud/... to
    cloud.google.com/go/.... For example, if your code imports the BigQuery client
    it currently reads
    import "google.golang.org/cloud/bigquery"
    It should be changed to
    import "cloud.google.com/go/bigquery"
  • Client options are also moving, from google.golang.org/cloud to
    google.golang.org/api/option. Two have also been renamed:
    • WithBaseGRPC is now WithGRPCConn
    • WithBaseHTTP is now WithHTTPClient
  • The cloud.WithContext and cloud.NewContext methods are gone, as are the
    deprecated pubsub and container functions that required them. Use the Client
    methods of these packages instead.

You should make these changes before September 12, 2016, when the packages at
google.golang.org/cloud will go away.