The meaning of ./... in make file is not clear [duplicate] - go

This question already has answers here:
What do three dots "./..." mean in Go command line invocations?
(2 answers)
What does the following argument in a terminal command mean: ./ [duplicate]
(1 answer)
Closed 6 months ago.
what is the meaning of ./... in make file.
Below are few example where it is used in the make file
https://github.com/cosmos/gaia/blob/main/Makefile#L102
https://github.com/strangelove-ventures/packet-forward-middleware/blob/main/Makefile#L111

... (ellipsis) is a wildcard used by go to represent all subdirectories (recursively).
You can see it documented in go help packages.
It is seen commonly in go get ./... to get the current directory's (.) packages and all its subdirectories (...) packages.

Related

How to run a program with one command? [duplicate]

This question already has answers here:
How to compile Go program consisting of multiple files?
(7 answers)
How to compile a program in Go
(1 answer)
Go: How does go run file.go work
(4 answers)
Closed 9 months ago.
I have an app. There are many .go files, but also there are files with tests.
Of course, the command go run *.go don't work correct.
And now I should write every time something like that: go run fileName.go fileName.go fileName.go and so forth.
Is it possible to run programs with a shorter command ?
Thank You

osx mkdir can not create folders at ~ [duplicate]

This question already has answers here:
"~/Desktop/test.txt: No such file or directory"
(2 answers)
Why isn't tilde (~) expanding inside double quotes? [duplicate]
(1 answer)
Closed 4 years ago.
I have a couple of scripts for configuring new computers. I have a section dedicated to osx, where I create specific osx stuff. I wanted to change the default location for screenshots,but first I need to create the required folder. However, when I try to create the folder at ~/Documents/screenshots I get a variety of errors:
If I just use mkdir, then it tells me that the file already exists
If I add the -p option then I get no error, but nothing happens, the file does not get created
I tried the same code on the console directly with identical results.
Here is a small part of the code. The get boolean response is just a small function that returs true or false depending if the user types Yes or No
#!/bin/bash
screenshotsFolder="~/Documents/screenshots"
if get_boolean_response "Create a folder for the screenshots at $screenshotsFolder?"; then
mkdir "$screenshotsFolder"
fi
I tried changing the name to a random one, but I get exactly the same results.
Any advice?

How can I access a directory that is in $HOME using bash? [duplicate]

This question already has answers here:
"~/Desktop/test.txt: No such file or directory"
(2 answers)
Why isn't tilde (~) expanding inside double quotes? [duplicate]
(1 answer)
Closed 4 years ago.
I'm new to Linux as well as bash. I made a script that accesses a folder that is located in the home directory, but the script will not always be called from the home directory. The prompt I'm getting when calling it from any subdirectories specifies that it can not find the file.
Here's an example of what I'm trying to do:
for entry in "~/.directory"/*
do
echo "$entry"
done
If I place the script in a subdirectory of /home and try to call it, the script is unable to find the directory. I know it exists as if I run ls ~/.directory in the subdirectory it is able to find the files and print them with no problem. Is there a different way I should be trying to access the directory in the bash shell? Thanks!
Voted to close my question. It seems rather specific to me, and the general solution was something I found earlier and was also posted in the comments below. I'll figure it out eventually -
Only unquoted tildes are expanded.
for entry in ~/".directory"/*

Is there a way to run go test for only one file? [duplicate]

This question already has answers here:
Just run single test instead of the whole suite? [duplicate]
(6 answers)
Closed 10 months ago.
I checked documentation and help tutorial. Didn't find answer.
I just want to run a_test.go not all *_test.go.
Is this possible or how?
thanks a lot!
Command Documentation
Command go
Description of testing flags
The following flags are recognized by the 'go test' command and
control the execution of any test:
-run regexp
Run only those tests and examples matching the regular
expression.
To run the tests which satisfy the regex regular expression:
go test -run=regexp

Why ./helloworld and not helloworld directly to run my program from terminal? [duplicate]

This question already has answers here:
Why do you need ./ (dot-slash) before executable or script name to run it in bash?
(9 answers)
Closed 8 years ago.
As the question asked I thought "." means the current directory so why can't we directly type helloworld to run the program?
Because '.', the current directory, is not in your environment's $PATH, which contains the list of paths where executables get searched. To see your PATH variable, type
echo $PATH
This is most likely for security reasons, to prevent execution of local executables named after system or other trusted installed ones. I have worked on systems where '.' was in the PATH and at the very least it lead to some confusing moments (the test utility being a favourite candidate for accidental replacement.)
I would advise against appending '.' to PATH for those reasons.

Resources