Giter Site home page Giter Site logo

doesn't work with my local project about gocap HOT 7 CLOSED

cugu avatar cugu commented on August 19, 2024 1
doesn't work with my local project

from gocap.

Comments (7)

cugu avatar cugu commented on August 19, 2024 1

In these cases /tmp/myWonderfullProject and github.com/sigstore/cosign are not Go packages (they do not contain any go files). gocap generate works on package basis. I should elaborate that more in the readme.

cd /tmp/myWonderfullProject && gocap generate ./cmd/myWonderfullProject > go.cap should work.
as well as
gocap generate ./cmd/cosign > go.cap (although this melts my CPU and takes 5min on my laptop because of the high number of dependencies).

Then you can check with cd /tmp/myWonderfullProject && gocap check ./cmd/myWonderfullProject or gocap check ./cmd/cosign

from gocap.

cugu avatar cugu commented on August 19, 2024

Can you provide some more information? The content of the main.go and the output of go list --json . should help.

from gocap.

jerome-laforge avatar jerome-laforge commented on August 19, 2024

I think the root cause is the directory, that contains go.mod & go.sum, doesn't contain go files, that is not acctually in my previous given example.

so I give another example:

mkdir -p /tmp/myWonderfullProject/cmd/myWonderfullProject
cd /tmp/myWonderfullProject

echo 'package main

import "github.com/gin-gonic/gin"

func main() {
        r := gin.Default()
        r.GET("/ping", func(c *gin.Context) {
                c.JSON(200, gin.H{
                        "message": "pong",
                })
        })
        r.Run() // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
}' > /tmp/myWonderfullProject/cmd/myWonderfullProject/main.go


go mod tidy
tree /tmp/myWonderfullProject
/tmp/myWonderfullProject
├── cmd
│   └── myWonderfullProject
│       └── main.go
├── go.mod
└── go.sum

gocap generate /tmp/myWonderfullProject
could not parse package path

from gocap.

Dentrax avatar Dentrax commented on August 19, 2024

+1, If I run the following, there is an error in the go.cap file: could not parse package path:

$ gocap generate github.com/sigstore/cosign > go.cap
$ cat go.cap
could not parse package path

from gocap.

jerome-laforge avatar jerome-laforge commented on August 19, 2024

cd /tmp/myWonderfullProject && gocap generate ./cmd/myWonderfullProject > go.cap should work.
as well as

Thx for this workaround, it works fine.
Maybe you can just close this issue, after you will update the readme?

from gocap.

Dentrax avatar Dentrax commented on August 19, 2024

@cugu thanks for clarification. But the following check command does not read go.cap file i think. 🤔

$ gocap generate ./cmd/myWonderfullProject > go.cap
$ gocap check go.cap
could not parse package path

from gocap.

cugu avatar cugu commented on August 19, 2024

Try gocap check ./cmd/myWonderfullProject

from gocap.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.