iron fuctions: fn build for iron/go can't load package github.com/x/y - ironfunctions

I am trying to run basic commands given in https://github.com/iron-io/functions.
I created a fuc.go and funct.yaml file successfully but when I try to execute fn build, I get below error:
Running prebuild command: docker run --rm -v /home/evr:/go/src/github.com/x/y -w /go/src/github.com/x/y iron/go:dev go build -o func
can't load package: package github.com/x/y: C source files not allowed when not using cgo or SWIG: swap_sll.c
error running docker build: exit status 1

I got the cause for the above issue
Actually it was looking for data directory of iron function which I had specified a specific path instead of ${PWD} and was executing fn build in another working dirctory. So have to execute fn build in that directory where data directory is present (specific path which I specified).

Related

Golang: generating core failed: unable to load github.com

I installed golang and started with this tutorial: https://www.howtographql.com/graphql-go/1-getting-started/
When I run:
go run github.com/99designs/gqlgen generate
I get:
reloading module info
generating core failed: unable to load github.com/my-user/hackernews/graph/model - make sure you're using an import path to a package that exists
exit status 1
What is wrong with my setup?
This is my gopath
/Users/my-pc-user/go
TLDR
$ cd your_project_path/
$ print '// +build tools\npackage tools\nimport _ "github.com/99designs/gqlgen"' | gofmt > ./tools.go
$ echo 'package model' | gofmt > ./graph/model/doc.go
$ go get .
Explanation
According to a quick start guide, you should create a package with generated code that actually is already imported by your server:
package main
import (
"log"
"net/http"
"os"
"github.com/99designs/gqlgen/graphql/handler"
"github.com/99designs/gqlgen/graphql/playground"
"your_module_name/graph"
"your_module_name/graph/generated"
)
Because of the fact that your_module_name/graph/generated has no *.go files you cannot start a server and if you try you will get an error like:
graph/schema.resolvers.go:10:2: no required module provides package your_module_name/graph/generated; to add it:
To generate that package you will need to execute go run github.com/99designs/gqlgen generate, but there is another problem: gqlgen generates code that uses another package that is still doesn't exist yet, i.e. your_module_name/graph/model.
Additional step adding build constraints is required to not drop indirect dependency while generation process. That's why there is the first step with underscore import.
And if you put any *.go file to that directory with package directive — everything should works now:
$ cd your_project_path/
$ print '// +build tools\npackage tools\nimport _ "github.com/99designs/gqlgen"' | gofmt > ./tools.go
$ echo 'package model' | gofmt > ./graph/model/doc.go
$ go get .

Error when I run this command "fx set core.qemu-x64"

ERROR at //third_party/openssh-portable/fuchsia/developer-keys/BUILD.gn:10:24: Could not read file.
manifest = read_file("//.fx-ssh-path", "list lines")
^---------------
I resolved this to "/home/shivkumar/fuchsia_os/fuchsia/.fx-ssh-path".
See //products/core.gni:102:3: which caused the file to be included.
"//third_party/openssh-portable/fuchsia/developer-keys:ssh_config",
^-----------------------------------------------------------------
ERROR: error running gn gen: exit status 1
This error means that the //.fx-ssh-path file does not exist, or is otherwise unreadable. This file is typically generated on source checkout when the integration manifest runs //tools/ssh-keys/gen-ssh-keys.sh as a jiri hook.
To correct the problem, use gen-ssh-keys.sh again to re-generate the file(s) before setting your build configuration:
$ tools/ssh-keys/gen-ssh-keys.sh
$ fx set core.qemu-x64
Note: Hooks are also run anytime you run jiri update so you could also resync the source tree to correct the issue.

`go test` only prints "open : no such file or directory"

I rewrite a program and just removed a lot of code, by just making it a comment. After doing that and adding some tests, it is impossible to run the program anymore.
when running go build it has no errors at all.
But when running go test i only become some weird output:
$ go test
2020/05/05 19:14:24 open : no such file or directory
exit status 1
FAIL fwew_lib 0.002s
This error occurs, before a single test is even run, so within the test framework itself.
Why is there is no file specified that is not found? Any idea, what caused this error and how to fix it?
This error also occurred on multiple machines with windows and linux. And with go 1.14.2 and go 1.13.7.
To get this error yourself:
Repo: https://github.com/knoxfighter/fwew/tree/library
Branch: library
Just download the branch and run go test
Your fork is missing this line from the parent
texts["dictionary"] = filepath.Join(texts["dataDir"], "dictionary.txt")
link
But your fork still has this line which depends on the one mentioned above
Version.DictBuild = SHA1Hash(texts["dictionary"])
link
And so the SHA1Hash "fatals" out since you're essentially passing it an empty string.
link

Buildkite Windows agent cannot find git executable

I'm having trouble getting the Windows build agent to run a build. The agent is unable to checkout my source code. (Im using Windows 10) See GitHub issue
I am seeing the following error when running a build:
Buildkite Error: There was an error running `git clone -v -- git#github.com:myorg/myrepo.git .` (exec: "git": executable file not found in %PATH%)
I have installed git using chocolatey and git is accessible in CMD and Powershell on the agent's host and I can see it in my path if I run gci env:Path in Powershell. git's directory is at the end here:
C:\Program Files\Docker\Docker\Resources\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\cm...
From a build's logs in BK's web UI, I see the following environment variables printed out:
BUILDKITE=true
BUILDKITE_AGENT_ACCESS_TOKEN=xxx
BUILDKITE_AGENT_DEBUG=true
BUILDKITE_AGENT_ENDPOINT=https://agent.buildkite.com/v3
BUILDKITE_AGENT_ID=xxx
BUILDKITE_AGENT_NAME=DESKTOP-1
BUILDKITE_AGENT_PID=5180
BUILDKITE_ARTIFACT_PATHS=
BUILDKITE_BIN_PATH=C:\Users\Jason\Downloads\buildkite-agent-windows-amd64-3.0-beta.27
BUILDKITE_BRANCH=fix/build
BUILDKITE_BUILD_CHECKOUT_PATH=builds\DESKTOP-1\myorg\myrepo
BUILDKITE_BUILD_CREATOR=Jason
BUILDKITE_BUILD_CREATOR_EMAIL=myemail#gmail.com
BUILDKITE_BUILD_ID=xxx
BUILDKITE_BUILD_NUMBER=18
BUILDKITE_BUILD_PATH=builds
BUILDKITE_BUILD_URL=https://buildkite.com/myorg/myrepo/builds/18
BUILDKITE_COMMAND=msbuild
BUILDKITE_COMMAND_EVAL=true
BUILDKITE_COMMIT=HEAD
BUILDKITE_GIT_CLEAN_FLAGS=-fxdq
BUILDKITE_GIT_CLONE_FLAGS=-v
BUILDKITE_HOOKS_PATH=hooks
BUILDKITE_JOB_ID=xxx
BUILDKITE_MESSAGE=First build
BUILDKITE_ORGANIZATION_SLUG=myorg
BUILDKITE_PIPELINE_DEFAULT_BRANCH=master
BUILDKITE_PIPELINE_PROVIDER=github
BUILDKITE_PIPELINE_SLUG=myrepo
BUILDKITE_PLUGINS_PATH=plugins
BUILDKITE_PROJECT_PROVIDER=github
BUILDKITE_PROJECT_SLUG=myorg/myrepo
BUILDKITE_PULL_REQUEST=false
BUILDKITE_PULL_REQUEST_REPO=
BUILDKITE_REPO=git#github.com:myorg/myrepo.git
BUILDKITE_REPO_SSH_HOST=github.com
BUILDKITE_RETRY_COUNT=0
BUILDKITE_SCRIPT_PATH=msbuild
BUILDKITE_SOURCE=ui
BUILDKITE_SSH_FINGERPRINT_VERIFICATION=true
BUILDKITE_TAG=
BUILDKITE_TIMEOUT=false
CI=true
PATH=C:\Users\Jason\Downloads\buildkite-agent-windows-amd64-3.0-beta.27;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL
Note that PATH in that output is not the same as my PATH from the Powershell and does not include the path to gits binary.
Full build output:
Build environment variables 0s
BUILDKITE=true
BUILDKITE_AGENT_ACCESS_TOKEN=xxx
BUILDKITE_AGENT_DEBUG=true
BUILDKITE_AGENT_ENDPOINT=https://agent.buildkite.com/v3
BUILDKITE_AGENT_ID=xxx
BUILDKITE_AGENT_NAME=DESKTOP-1
BUILDKITE_AGENT_PID=5180
BUILDKITE_ARTIFACT_PATHS=
BUILDKITE_BIN_PATH=C:\Users\Jason\Downloads\buildkite-agent-windows-amd64-3.0-beta.27
BUILDKITE_BRANCH=fix/build
BUILDKITE_BUILD_CHECKOUT_PATH=builds\DESKTOP-1\myorg\myrepo
BUILDKITE_BUILD_CREATOR=Jason
BUILDKITE_BUILD_CREATOR_EMAIL= myemail#gmail.com
BUILDKITE_BUILD_ID=xxx
BUILDKITE_BUILD_NUMBER=18
BUILDKITE_BUILD_PATH=builds
BUILDKITE_BUILD_URL=https://buildkite.com/myorg/myrepo/builds/18
BUILDKITE_COMMAND=msbuild
BUILDKITE_COMMAND_EVAL=true
BUILDKITE_COMMIT=HEAD
BUILDKITE_GIT_CLEAN_FLAGS=-fxdq
BUILDKITE_GIT_CLONE_FLAGS=-v
BUILDKITE_HOOKS_PATH=hooks
BUILDKITE_JOB_ID=xxx
BUILDKITE_MESSAGE=First build
BUILDKITE_ORGANIZATION_SLUG=myorg
BUILDKITE_PIPELINE_DEFAULT_BRANCH=master
BUILDKITE_PIPELINE_PROVIDER=github
BUILDKITE_PIPELINE_SLUG=myrepo
BUILDKITE_PLUGINS_PATH=plugins
BUILDKITE_PROJECT_PROVIDER=github
BUILDKITE_PROJECT_SLUG=myorg/myrepo
BUILDKITE_PULL_REQUEST=false
BUILDKITE_PULL_REQUEST_REPO=
BUILDKITE_REPO=git#github.com:myorg/myrepo.git
BUILDKITE_REPO_SSH_HOST=github.com
BUILDKITE_RETRY_COUNT=0
BUILDKITE_SCRIPT_PATH=msbuild
BUILDKITE_SOURCE=ui
BUILDKITE_SSH_FINGERPRINT_VERIFICATION=true
BUILDKITE_TAG=
BUILDKITE_TIMEOUT=false
CI=true
PATH=C:\Users\Jason\Downloads\buildkite-agent-windows-amd64-3.0-beta.27;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL
Running global environment hook 0s
# Skipping, no hook script found at "hooks\environment.bat"
Running global pre-checkout hook 0s
# Skipping, no hook script found at "hooks\pre-checkout.bat"
Preparing build directory 0s
# Changing working directory to "builds\DESKTOP-1\myorg\myrepo"
⚠ Buildkite Warning: Could not performn `ssh-keygen` (exec: "ssh-keygen": executable file not found in %PATH%)
> git clone -v -- git#github.com:myorg/myrepo.git .
🚨 Buildkite Error: There was an error running `git clone -v -- git#github.com:myorg/myrepo.git .` (exec: "git": executable file not found in %PATH%)
Your build output doesn't seem to have those chocolatey paths:
PATH=C:\Users\Jason\Downloads\buildkite-agent-windows-amd64-3.0-beta.27;
You might need to add an agent environment hook which adds the right directories to the path. Or try updating to the latest beta which might fix the issue.

Use File Watcher in IntelliJ to run Makefile

I would like to run a Makefile in IntelliJ whenever a source file changes. Therefore I installed the File Watcher plugin and added a new File Watcher for Go files. In the Watcher Settings I added make as the Program and test for the Arguments.
When I now change a .go file, I get the following error message:
make test
make: *** No rule to make target `test'. Stop.
Process finished with exit code 2
so I assume that the file watcher works in general but is somehow runs the make command in the wrong directory.
When I run make test in a terminal from the root of my project, everything works as expected and I get:
Formatting all packages...
Code analysis with go vet...
Execute test with ginkgo...
[1490735873] Cmd Suite - 1/1 specs • SUCCESS! 120.183µs PASS
[1490735873] Test Helpers Suite - 4/4 specs •••• SUCCESS! 125.046µs PASS
[1490735873] Models Suite - 5/5 specs ••••• SUCCESS! 453.456µs PASS
[1490735873] Services Suite - 16/16 specs •••••••••••••••• SUCCESS! 3.035275ms PASS
Ginkgo ran 4 suites in 855.886243ms
Test Suite Passed
What am I doing wrong - or am I missing the point of using file watchers in IntelliJ?
Solution was that I had to specify the Working Directory in Other Options. When I set this to $ContentRoot$, everything works as expected.

Resources