use google/wire with goland get undefined: InitializeEvent - dependency-injection

i am learning google/wire with official tutorial, i can generate wire_gen.go file with wire command, but got erro :"undefined: InitializeEvent" when i start build using goland.

if exec commond "go build main.go", go don't build wire_gen.go file. so we should use commond "go build" or "go build main.go wire_gen.go", then go will build both main.go and wire_gen.go.
in goland we should change build configuration

Related

npm run build in azure pipeline does not create build folder in the azure repository?

I am basically trying to create build and release pipelines for a react js app.The tasks in the build pipeline include npm install,npm run build,then build and push a docker image using dockerfile(nginx serving the build folder).Then in the release pipeline I want to do a kubectl apply on the nginx yaml.
My problem is that the task npm run build is not creating the build folder in the azure repos which is where I pushed my code into.
I tried removing the line "#production /build" from the file gitignore from the azure repos.
Dockerfile used for building image
FROM nginx
COPY /build /usr/share/nginx/html
since the build folder was not created in the azure repos,the build docker image task in the build pipeline keeps failing.Please help
Here is a contributor in a case with similar issue giving a solution.
His solution is:
For "npm build" task, the custom command (In question above, tried
"build" and "npm run-script build") should be "run-script build". The
build has successfully created the dist folder.
For details ,you can refer to this case.

Could not find 'xxx.Program' specified for Main method when building dotnet app in Docker container

I am having issues when building a dotnet core application inside a docker container. I am using dotnet core 2.2.
The setting for the project are:
Output: Console App
Startup Project: Web.Project
When running the command below inside the container:
RUN dotnet build "Web.csproj" -c Release -o /app
I get the error below:
Could not find 'Web.Program' specified for Main method [/src/Web/Web.csproj]
If the project is just an assembly (dll) everything works fine but I'm unable to run the web app.
Any ideas?
The solution to my problem was to remove the following line from my csproj file:
<OutputType>EXE</OutputType>
It seems like visual studio 2107 adds that tag when changing the output type. Once I removed that, I was able to build and publish inside a Docker Container and Windows.
In my case that was folder with repository /home/ubuntu/project was the same folder as i targeted to build dotnet build -C Release --runtime ubuntu.18.04-x64 --output /home/ubuntu/project`.
Solution was to change it dotnet build -C Release --runtime ubuntu.18.04-x64 --output /home/ubuntu/project_build`
Using my case, since I changed the name of the namespace and solution.
I edited the .csproj
at every tag where I found the old name, I replaced it with the new one,
Cleaned build, build and the error went away

Specflow tests in teamcity

How can I configure the build process in TeamCity to execute SpecFlow tests?
I am using visual studio 2017 with the Specrun.Specflow nuget package installed.
Can it be done with Nunit or SpecRun.exe?
To run the SpecFlow tests with the SpecFlow+Runner (aka SpecRun), you need to do this:
Open your project's build steps.
Click on Add build step.
Choose "Command Line" from the dialogue.
Configure the build step as follows:
Run: Executable with parameters
Command executable: Enter the path to SpecRun.exe here
Command parameters: Enter the command line parameters for SpecRun.exe here. Use the BuildServerRun option and include /buildserver:teamcity.
Information on executing command lines in TeamCity is available here. More details on the
SpecFlow+ Runner's command line options can be found here.
Click on Save.
Taken from https://specflow.org/plus/documentation/SpecFlowPlus-and-TeamCity/

How to copy OpenCV DLL files into cmake debug/release folder?

I need to copy
C:\opencv-3.4.0.-opencl\bin\Debug\*.dll =>
myproj\build\bin\Debug\*.dll
and also
C:\opencv-3.4.0.-opencl\bin\Release\*.dll =>
myproj\build\bin\Release\*.dll
I'd like to do it in one command for Build/Release if possible.
You can copy files on a post-build command. A step through tutorial can be found here.
The basic concept is that you can use batch file commands, as a post-build step in Visual Studio to do basically anything you want as you build.
A further tutorial can be found here
For CMAKE
The easiest way is to follow the advice above but instead of putting it in the post-build options in VS just add a custom command
You can try using CPack to handle multiple configuration at one go. See an example in the following tutorial
https://cmake.org/cmake/help/latest/guide/tutorial/index.html#packaging-debug-and-release-step-12
By default, CMake’s model is that a build directory only contains a
single configuration, be it Debug, Release, MinSizeRel, or
RelWithDebInfo. It is possible, however, to setup CPack to bundle
multiple build directories and construct a package that contains
multiple configurations of the same project.
Then you will need to use either of the following method for each configuration to copy the files you need
configure_file
https://cmake.org/cmake/help/latest/command/configure_file.html
or
add_custom_command
https://cmake.org/cmake/help/latest/command/add_custom_command.html
Here is an example from reddit
https://www.reddit.com/r/cmake/comments/gmewhu/copy_one_file_in_src_directory_to_build_directory/
# Copy <filename> to build directory
set(copy_source_dir "${CMAKE_SOURCE_DIR}/src/<path>")
set(copy_dest_dir "${CMAKE_BINARY_DIR}/Build/<path>/$<CONFIG>")
set(copy_file_name "<filename>")
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${copy_dest_dir}
)
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${copy_source_dir}/${copy_file_name}" "${copy_dest_dir}/${copy_file_name}"
COMMENT "Copying ${copy_file_name} to build directory"
)

Custom command in npm tfs 2015

I'm creating vNext builds using tfs 2015 and I want to run custom command in npm task. The command - npm lint. During build I have error that this command is unknow.
this is how looks my step:
If it's a command like start/stop/install then everything is ok.
How I can customize this step?
Just as error described, npm lint is not a cli commands. The detail list of cli commands please refer npm docs.
It's not support to run it with npm build task in TFS build definition.
The only one what I added it's command "run" before lint. So final command will be "run lint".

Resources