Skip to content

Commit

Permalink
main: small fix (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
rotemtam committed Jun 20, 2023
1 parent 45c5889 commit 61c83dc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ curl -sSf https://atlasgo.sh | sh
```
See [atlasgo.io](https://atlasgo.io/getting-started#installation) for more installation options.

Install the provider by running:
```bash
go get -u ariga.io/atlas-provider-gorm
```

#### Standalone

If all of your GORM models exist in a single package, and either embed `gorm.Model` or contain `gorm` struct tags,
Expand All @@ -29,6 +34,7 @@ data "external_schema" "gorm" {
"run",
"-mod=mod",
"ariga.io/atlas-provider-gorm",
"load",
"--path", "./path/to/models",
"--dialect", "mysql", // | postgres | sqlite
]
Expand Down
3 changes: 1 addition & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"bytes"
"context"
_ "embed"
"errors"
"fmt"
Expand Down Expand Up @@ -46,7 +45,7 @@ type LoadCmd struct {
out io.Writer
}

func (c *LoadCmd) Run(_ context.Context) error {
func (c *LoadCmd) Run() error {
cfg := &packages.Config{Mode: packages.NeedName | packages.NeedTypes | packages.NeedTypesInfo | packages.NeedModule | packages.NeedDeps}
pkgs, err := packages.Load(cfg, c.Path)
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"bytes"
"context"
"testing"

"github.com/stretchr/testify/require"
Expand All @@ -17,7 +16,7 @@ func TestLoad(t *testing.T) {
Dialect: dialect,
out: &buf,
}
err := cmd.Run(context.Background())
err := cmd.Run()
require.NoError(t, err)
require.Contains(t, buf.String(), "CREATE TABLE")
require.Contains(t, buf.String(), "pets")
Expand Down

0 comments on commit 61c83dc

Please sign in to comment.