I'm trying to compile a fork of cuttle that merges this pull request
by running
# GOPATH=`pwd` /usr/local/go/bin/go get github.com/andresdouglas/cuttle
# github.com/andresdouglas/cuttle
src/github.com/andresdouglas/cuttle/main.go:103: zone.GetController(r.URL.Host, r.URL.Path).Acquire() used as value
Here is the offending line
I have no experience with Go. Is that an error? It doesn't seem to update the compiled binary.
Check the source code here:
// Acquire permission from NoopControl.
// Permission is granted immediately since it does not perform any rate limit.
func (c *NoopControl) Acquire() {
log.Debugf("NoopControl[%s]: Seeking permission.", c.Label)
log.Debugf("NoopControl[%s]: Granted permission.", c.Label)
}
There is NO return value of func (c *NoopControl) Acquire().
Related
I am using this Windows API wrapper to try and get bitlocker status.
My code is:
test, err := wapi.GetBitLockerConversionStatus()
I am getting the following error:
err wmi.Connect: permission denied: Exception occurred. (Access denied )
When I'm logged with the same user I can get results with C# code:
IShellProperty prop = ShellObject.FromParsingName("C:").Properties.GetProperty("System.Volume.BitLockerProtection");
I have tried to call other functions in the Go wrapper such as wapi.ProcessList() and it works, so the permission issue seems to be specific to the BitLocker function and not the whole package or anything else.
My question is why does it require special permission in Go but not in C# and is there a way to get that information without elevated permission?
How can I set logging level for golang glog package to ERROR.
example.go:
package main
import (
"github.com/golang/glog"
"flag"
)
func main() {
flag.Parse()
glog.Info("Info level")
glog.Error("Error level")
glog.Flush()
}
$ go run example.go -logtostderr=true -stderrthreshold=ERROR
I1214 15:46:00.743002 13429 example.go:10] Info level
E1214 15:46:00.743211 13429 example.go:11] Error level
In the above example I have set the stderrthreshold flag to ERROR but am still getting INFO level logs. I want only ERROR level logs.
By default, glog will write
all log messages to log files (they are created in /tmp by default);
log messages with a severity of stderrthreshold or above to stderr.
By using the -logtostderr=true flag this behaviour is changed:
Logs are written to standard error instead of to files.
no log messages are written to log files;
all log messages are written to stderr.
The stderrthreshold presumably has no effect when -logtostderr=true is used. And in your invocation it didn't have an effect anyway, because the default threshold is already ERROR.
To summarize, by just running go run example.go without any command line arguments, only log messages with severity ERROR or above are written to stderr, as you desired.
I started to create a very light weight message broker to practice go, travis and some aws services all in one project.
My current problem is that I can build, run and test my develop branch on my local machine however when travis attempts to build it I get a compile error. The code it doesn't like came straight from AWS examples to further deepen the mystery for me.
Travis failed build
https://travis-ci.org/hevnly/eevy/builds/65687886
Github repo https://github.com/hevnly/eevy/tree/92412cf729ed546d698ded1e514d2d54c340ff81
Error
handler/lambda.go:31: cannot use "github.com/awslabs/aws-sdk-go/aws".Config literal (type *"github.com/awslabs/aws-sdk-go/aws".Config) as type *"github.com/aws/aws-sdk-go/aws".Config in argument to lambda.New
handler/sqs.go:26: cannot use "github.com/awslabs/aws-sdk-go/aws".Config literal (type *"github.com/awslabs/aws-sdk-go/aws".Config) as type *"github.com/aws/aws-sdk-go/aws".Config in argument to sqs.New
Sample of code
svc := lambda.New(&aws.Config{Region: "eu-west-1"})
Ok, I have just tried to go get your repo and got the same error:
handler/lambda.go:29: cannot use "github.com/awslabs/aws-sdk-go/aws".Config literal (type *"github.com/awslabs/aws-sdk-go/aws".Config) as type *"github.com/aws/aws-sdk-go/aws".Config in argument to lambda.New
handler/sqs.go:26: cannot use "github.com/awslabs/aws-sdk-go/aws".Config literal (type *"github.com/awslabs/aws-sdk-go/aws".Config) as type *"github.com/aws/aws-sdk-go/aws".Config in argument to sqs.New
I advice you to start using a dependency manager, so you will fix your dependencies inside your repo and have reproducible builds in any place.
My recommendation is Godep, but there are others out there.
While I compile a go language code using "go install", I got the following error:
./xyzcheck.go:34: unknown tls.Config field 'EarlyCCS' in struct literal
here is the code that make that error
conn, err = tls.Dial("tcp", target, &tls.Config{InsecureSkipVerify: true, EarlyCCS: 2})
if err == nil {
fmt.Printf("\x1b[31mXYZ Check is OK.\x1b[0m\n")
os.Exit(1)
}
I googled this error but no luck.
If anyone can tell me what is the reason for this error? and how can I fix it. it will be great.
Thanks
ABC: 2 is not a valid parameter for config. There is documentation on config settings for tls here: http://golang.org/pkg/crypto/tls/#Config
The author has a patch that needs to be applied to the tls package. This was clearly explained on his blog page where you obtained this script.
Apply the patch to the tls package, re-run the script and it will work.
I am new to golang and currently following this tutorial and source code here - http://golang.org/doc/articles/wiki/part2.go
After building this file, I am getting
calvin$ ./mywebwiki2
2012/07/23 17:12:59 http: panic serving [::1]:58820: runtime error: invalid memory address or nil pointer dereference
/usr/local/go/src/pkg/net/http/server.go:576 (0x3f202)
_func_003: buf.Write(debug.Stack())
/private/tmp/bindist454984655/go/src/pkg/runtime/proc.c:1443 (0x10c79)
/private/tmp/bindist454984655/go/src/pkg/runtime/runtime.c:128 (0x11745)
/private/tmp/bindist454984655/go/src/pkg/runtime/thread_darwin.c:418 (0x148b5)
/Users/calvin/work/gowiki/mywebwiki2.go:33 (0x2248)
viewHandler: fmt.Fprintf(w, "<h1>%s</h1><div>%s</div>", p.Title, p.Body)
/usr/local/go/src/pkg/net/http/server.go:690 (0x331ae)
HandlerFunc.ServeHTTP: f(w, r)
/usr/local/go/src/pkg/net/http/server.go:926 (0x34030)
(*ServeMux).ServeHTTP: mux.handler(r).ServeHTTP(w, r)
/usr/local/go/src/pkg/net/http/server.go:656 (0x32fc1)
(*conn).serve: handler.ServeHTTP(w, w.req)
/private/tmp/bindist454984655/go/src/pkg/runtime/proc.c:271 (0xed7f)
2012/07/23 17:12:59 http: panic serving [::1]:58821: runtime error: invalid memory address or nil pointer dereference
Any idea what I did wrong to be causing this apparent memory corruption?
There's an ignored err at line 36. The error probably says open .txt: no such file or directory if you tested in browser using URL http://localhost:8080/view/ or open foo.txt: no such file or directory if you tested in browser using URL http://localhost:8080/view/foo. In the later case there must be a file "foo.txt" in your working directory for this example code to work. After that the code seems to work for me locally.
Someone should probably fill an issue about the ignored error value.
In the tutorial, you created the file TestPage previously. Which is the page you should be navigating to when you first build the server. In the tutorial, they have you navigate to view/test instead of view/TestPage as you should which is what creates the confusion.