Skip to content

Commit

Permalink
Fix build by not having cmd/* be packages
Browse files Browse the repository at this point in the history
Just have cmd/machine/cmd/ and cmd/machined/cmd be the
main packages for each executable respectively.  (Maybe
we should drop cmd/ there)

Give the full module name in go.mod

Signed-off-by: Serge Hallyn <[email protected]>
  • Loading branch information
hallyn committed Oct 10, 2023
1 parent 80ca040 commit 1b247c8
Show file tree
Hide file tree
Showing 18 changed files with 33 additions and 37 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ all: $(BINS)
clean:
rm -f -v $(BINS)

bin/machine: cmd/machine/*.go cmd/machine/cmd/*.go pkg/*/*.go
go build -o $@ cmd/machine/*.go
bin/machine: cmd/machine/cmd/*.go pkg/*/*.go
go build -o $@ cmd/machine/cmd/*.go

bin/machined: cmd/machined/*.go cmd/machined/cmd/*.go pkg/*/*.go
go build -o $@ cmd/machined/*.go
bin/machined: cmd/machined/cmd/*.go pkg/*/*.go
go build -o $@ cmd/machined/cmd/*.go
4 changes: 2 additions & 2 deletions cmd/machine/cmd/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
package main

import (
"encoding/json"
"fmt"
"machine/pkg/api"
"os"
"os/exec"

log "github.com/sirupsen/logrus"
"github.com/project-machine/machine/pkg/api"
"github.com/spf13/cobra"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/machine/cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
package main

import (
"fmt"
"machine/pkg/api"

"github.com/spf13/cobra"
"github.com/project-machine/machine/pkg/api"
)

// deleteCmd represents the list command
Expand Down
4 changes: 2 additions & 2 deletions cmd/machine/cmd/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
package main

import (
"fmt"
"machine/pkg/api"
"os"

"github.com/lxc/lxd/shared"
"github.com/lxc/lxd/shared/termios"
"github.com/project-machine/machine/pkg/api"
"github.com/spf13/cobra"
"golang.org/x/sys/unix"
"gopkg.in/yaml.v2"
Expand Down
6 changes: 3 additions & 3 deletions cmd/machine/cmd/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
package main

import (
"machine/pkg/api"

"github.com/spf13/cobra"

"github.com/project-machine/machine/pkg/api"
)

// guiCmd represents the gui command
Expand Down
2 changes: 1 addition & 1 deletion cmd/machine/cmd/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
package main

import (
"fmt"
Expand Down
4 changes: 2 additions & 2 deletions cmd/machine/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
package main

import (
"fmt"
"io/ioutil"
"machine/pkg/api"
"os"
"path/filepath"
"sort"
Expand All @@ -26,6 +25,7 @@ import (
"github.com/lxc/lxd/shared"
"github.com/lxc/lxd/shared/termios"
homedir "github.com/mitchellh/go-homedir"
"github.com/project-machine/machine/pkg/api"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"golang.org/x/sys/unix"
Expand Down
2 changes: 1 addition & 1 deletion cmd/machine/cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
package main

import (
"fmt"
Expand Down
4 changes: 1 addition & 3 deletions cmd/machine/main.go → cmd/machine/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ limitations under the License.
*/
package main

import "machine/cmd/machine/cmd"

func main() {
cmd.Execute()
Execute()
}
4 changes: 2 additions & 2 deletions cmd/machine/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
package main

import (
"context"
"encoding/json"
"fmt"
"machine/pkg/api"
"math/rand"
"net"
"net/http"
Expand All @@ -27,6 +26,7 @@ import (
"time"

"github.com/go-resty/resty/v2"
"github.com/project-machine/machine/pkg/api"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/machine/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
package main

import (
"fmt"
Expand Down
4 changes: 2 additions & 2 deletions cmd/machine/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
package main

import (
"fmt"
"machine/pkg/api"

"github.com/project-machine/machine/pkg/api"
"github.com/spf13/cobra"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/machine/cmd/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
package main

import (
"fmt"
"machine/pkg/api"

"github.com/project-machine/machine/pkg/api"
"github.com/spf13/cobra"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/machined/cmd/install.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package cmd
package main

import (
"fmt"
"machine/pkg/api"
"os"
"os/exec"
"path/filepath"

"github.com/project-machine/machine/pkg/api"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
Expand Down
4 changes: 1 addition & 3 deletions cmd/machined/main.go → cmd/machined/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ limitations under the License.
*/
package main

import "machine/cmd/machined/cmd"

func main() {
cmd.Execute()
Execute()
}
4 changes: 2 additions & 2 deletions cmd/machined/cmd/remove.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package cmd
package main

import (
"fmt"
"machine/pkg/api"
"os"
"os/exec"
"path/filepath"

"github.com/project-machine/machine/pkg/api"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
Expand Down
4 changes: 2 additions & 2 deletions cmd/machined/cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package cmd
package main

import (
"context"
"fmt"
"io/ioutil"
"machine/pkg/api"
"math/rand"
"net/http"
"os"
Expand All @@ -14,6 +13,7 @@ import (
"text/template"
"time"

"github.com/project-machine/machine/pkg/api"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module machine
module github.com/project-machine/machine

go 1.18

Expand Down

0 comments on commit 1b247c8

Please sign in to comment.