Why does 'go vet' complain only in some versions of Go? [closed] - go

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
Today I included 'go vet' in one of my pipelines that builds a go service. I wonder why go vet's output on my local machine is different from the one that runs on the CI server.
I figured out that the go version differs - at least a bit. My local Go version is 1.12.4 and the CIs is version 1.12.7. This fact would explain the different behaviour, but I don't get why this happens!
There is the smell:
type Something struct {
...
BatteryNumber string `json:"number"`
...
}
type SomethingWithBattery struct {
Something
Number string `json:"number"`
...
}
So, two times 'number' in the struct tags, because Something-struct is nested SomethingWithBattery - 1.12.4 complains, 1.12.7 does not. Why?

Go 1 and the Future of Go Programs
Tools
Finally, the Go toolchain (compilers, linkers, build tools, and so on)
is under active development and may change behavior. This means, for
instance, that scripts that depend on the location and properties of
the tools may be broken by a point release.
go vet is under active development and recently it has been rewritten. There is no compatibility guarantee for tools, only the language.
cmd/vet: Consider reverting tag conflict for embedded fields #30465
go vet fails due to intended shadowing of embedded fields with json
tags.
Also, bug fixes are applied to the Go tools. For example, Issue 30465.

Related

How to get stats on go packages? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I am trying to track and understand the download stats for various go packages to evaluate the download patter over time for the go driver published and released by my team.
Something similar to npm-stats
https://npm-stat.com/
I see similar stats available for pip-python and npm.
https://npm-stat.com/
That may happen once the Go Notary service described in "Go Modules in 2019" is in place:
For publicly-available modules, we intend to run a service we call a notary that follows the module index log, downloads new modules, and cryptographically signs statements of the form “module M at version V has file tree hash H.” The notary service will publish all these notarized hashes in a queryable, Certificate Transparency-style tamper-proof log, so that anyone can verify that the notary is behaving correctly.
This log will serve as a public, global go.sum file that go get can use to authenticate modules when adding or updating dependencies.
We are aiming to have the go command check notarized hashes for publicly-available modules not already in go.sum starting in Go 1.13.
If statistics were to be produced, the Go notary would be a reliable source (for public packages)
Go doesn't have a centralized package registry such as npm or pip.
Also, go dependency management is still not "unified", some use dep some glide or go mod. All of these rely on version control software such as git.
If your package is on Github, you could check the Insights > Traffic tab and see unique cloners for example.
Another solution might be to implement a proxy to your git server to track clones.
You Can't do this.
As those are developed as part of Go language. Like npm packages you are not downloading it.
try gocenter.io, it includes download stats for all modules available. Example - logrus was downloaded 544k+ times - https://search.gocenter.io/github.com~2Fsirupsen~2Flogrus/info?version=v1.4.3-0.20191026113918-67a7fdcf741f

Let quality gate violation fail incremental analysis [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 10 months ago.
Improve this question
We're trying to set up a pull-request build pipeline that is triggered from Bitbucket, reports back failure when Sonarqube's code analysis reports some quality gate violation and ultimatively rejects the PR.
As far as I have read, the build breaker plugin, that should enable such a thing, is no longer supported in the most recent versions of Sonarqube, at least not in incremental / preview modes, since they now work database-less.
What are my alternatives for creating such a functionality? Sticking with 5.0?
Also, I figured that since quite some time Sonarqube can spit out Text / HTML reports for CI analysis - does this output quality gate violations as well or only all individual inspection results? Should one retrieve the former via API then? But I suspect this would require a full analysis, since it requires the results to be saved to the database, right?
There are two Bitbucket-related plugins to analyze pull requests. One for On Demand/Cloud and one for Server. Each will add comments to your pull request, and the On Demand version will approve a PR with no new issues.
Regarding your second question, the Issue Reports you're referring to contain only issues. In fact, it's not possible to calculate general Quality Gate compliance from a preview/incremental analysis since such analyses look only at issues, and Quality Gates can contain conditions on tests, duplications, &etc.

Go: how many packages per project [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
While working on my Go project today, I realised I had ran into a small problem. I had a package that had a struct that held a pointer to a struct from another package. However, that package also made use of a struct from the other package. In C and C++, this wouldn't pose an issue, as I'd use a header guard. However, in Go, such a program won't compile due to infinite import recursion.
This made me wonder, are there too many packages in my project? Should I favour bigger packages? I've always been told that each package should be specifically focused on one thing.
Right now, my structure is like this.
game/ <-- imports engine, needs to access the resource manager a lot
video/ <-- rendering goes here
renderer.go
shader.go
scene.go
...
engine/ <-- imports video, file, etc
root.go <-- contains a Root struct, handles initialisation etc
resource.go
...
file/
dds.go
config.go
resource_list.go
script.go
...
main.go
...
That said, here are my questions:
How would you solve this? Would you combine the video and engine packages? Redesign your program so that video no longer depends on engine?
How do you decide when it's appropriate to make a new package? Do you base it on functionality? Do you group it by category?
How much use do you make of the main package? I personally tend to get out of it as quickly as possible, maybe because I'm too used to OOP.
As these questions are rather broad and project-specific, I can only hope this is of any help:
Personally, I would try to create a third package on which both video and engine can rely. Depending on the project though, this might be a difficult thing to do, and they might need to be merged.
A new package is usually about one specific task. Depending on the project, this might be database I/O, including all models as well - but it might also be a package that's just about reading configuration files from the disk.
As I've built mostly web-apps, I use the main package to get things started: listening to ports, calling other functions, making sure database connections are closed properly, etc.
Example (not sure if helpful? ) :
I once had a package that was just about configurations (config), which referred to the rest of the packages (for some reason). The other packages however, depended on those configurations inside config. This is where the main package can come in handy: linking the config package with the other packages, by means of parameters.
The comment from VonC is also very useful and elaborate. It will probably help you more than this.

How to create a JMeter Plugin [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I've been trying to figure out how to add on to the functionality of JMeter for a couple days, and I'm sort of stumped. I basically want to build a testing functionality of a proprietary DB (it's not too important on the specifics here). However, the issue I am encountering is where to even begin with the creation of the functionality.
I've tried various stuff on the JMeter website (an example) and the wiki (an example), but it all boils down to I can't seem to find a repository which I can pull into eclipse (or with just building with ant, I can't seem to download_jars because it can't connect to the repo listed in there). Is there any up to date resources on how to build a JMeter plug in? Or am I doing something wrong here because I am inexperienced in setting up something like this?
Any help is greatly appreciated, but please don't just link the first thing on google; I have done quite a bit of searching already. Thanks!
Edit: It turned out the reason I couldn't get eclipse working with a repo was due to the network restrictions I had to deal with. When I tried on another computer/network, it worked fine. I used this jmeter tutorial, but since it is out of date regarding the repository (they use SVN now), I used http://svn.apache.org/repos/asf/jmeter as the root using subclipse. In case anyone runs into the same problem I did.
I have also searched for a building jmeter plugin for my graph plugin stuff. I got a simple and good source code from Ruben laguna's blog. You can understand the basic structure and steps to create jmeter plugin.
Check out this:
Graph plugin - http://rubenlaguna.com/wp/better-jmeter-graphs/
Enhanced-jdbc-sampler - http://rubenlaguna.com/wp/enhanced-jdbc-sampler-for-apache-jmeter-22/

What are all of the automated build tasks that can be performed? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I'm curious. I'm looking into creating a CI server and wondering, after the first couple of obvious tasks, what else can an automated build do?
The tasks that I'm aware of (not in any order):
Compile (debug/release versions)
Code style conformance
Automated tests (unit/integration/etc.)
Code coverage
Version incrementing
Deployment
I'm not looking for the names of software, the build engine to use, or anything like that; just the repetitive and (maybe) important tasks that can be automated to make the build process ridiculously simple from an end-user perspective.
The simple answer to this, is basically anything that a script can be written for.
For example if you are using CruiseControl, anything that you can do from an ant script can be automated; and that includes calling other (not necessarily ant scripts as well).
That being said, you've got most bases covered in your initial list. To that I would add
Generation of documentation
Repository maintencnace and backup operations
Auto-update company website, e.g. whenever there's a new release of software, documentation is updated, etc
Reports, e.g. aggregate and summarise bug tracker issues and activity per project/ product
HTH
Building documentation
Building installers
Creating web sites
Initialising virtual images
Setting up databases
Reporting?
You may want to report the things you find during those tasks you outlined above. You could also do things such as duplication reporting, or if you run something like findbugs you could report on issues found (e.g. http://findbugs.sourceforge.net/bugDescriptions.html)
You could also generate a releasable package of the product in the build.
It all about automation. If you can find something that needs to be done, then automate it. For example you can do tonnes of code analysis, or testing. Ultiamtely it comes down to repeating things easily. Find what you need to do to improve quality and automate those(And I strongly fally down on the side of more testing is better).

Resources