~eliasnaur/gio-patches

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 2

[PATCH gio] all: sort and group imports

~schnwalter
Details
Message ID
<160817579124.14978.2030286403566358290-0@git.sr.ht>
DKIM signature
missing
Download raw message
Patch: +36 -22
From: Walter Werner SCHNEIDER <contact@schnwalter.eu>

Signed-off-by: Walter Werner SCHNEIDER <contact@schnwalter.eu>
---
 app/internal/d3d11/backend_windows.go  | 3 ++-
 app/internal/window/os_wayland.go      | 3 ++-
 app/internal/window/os_x11.go          | 3 ++-
 font/gofont/gofont.go                  | 5 +++--
 font/opentype/opentype.go              | 7 ++++---
 font/opentype/opentype_test.go         | 7 ++++---
 internal/d3dcompile/compile_windows.go | 3 +--
 internal/rendertest/clip_test.go       | 3 ++-
 internal/rendertest/render_test.go     | 3 ++-
 internal/rendertest/transform_test.go  | 3 ++-
 internal/rendertest/util_test.go       | 3 ++-
 text/lru.go                            | 3 ++-
 text/shaper.go                         | 3 ++-
 text/text.go                           | 3 ++-
 widget/icon.go                         | 3 ++-
 widget/material/theme.go               | 3 ++-
 16 files changed, 36 insertions(+), 22 deletions(-)

diff --git a/app/internal/d3d11/backend_windows.go b/app/internal/d3d11/backend_windows.go
index 48ff175..4ecb44a 100644
--- a/app/internal/d3d11/backend_windows.go
+++ b/app/internal/d3d11/backend_windows.go
@@ -9,9 +9,10 @@ import (
	"math"
	"unsafe"

	"golang.org/x/sys/windows"

	"gioui.org/gpu/backend"
	gunsafe "gioui.org/internal/unsafe"
	"golang.org/x/sys/windows"
)

const debug = false
diff --git a/app/internal/window/os_wayland.go b/app/internal/window/os_wayland.go
index 1924d23..535cf0c 100644
--- a/app/internal/window/os_wayland.go
+++ b/app/internal/window/os_wayland.go
@@ -19,6 +19,8 @@ import (
	"time"
	"unsafe"

	syscall "golang.org/x/sys/unix"

	"gioui.org/app/internal/xkb"
	"gioui.org/f32"
	"gioui.org/internal/fling"
@@ -27,7 +29,6 @@ import (
	"gioui.org/io/pointer"
	"gioui.org/io/system"
	"gioui.org/unit"
	syscall "golang.org/x/sys/unix"
)

// Use wayland-scanner to generate glue code for the xdg-shell and xdg-decoration extensions.
diff --git a/app/internal/window/os_x11.go b/app/internal/window/os_x11.go
index e75313e..ab44ca8 100644
--- a/app/internal/window/os_x11.go
+++ b/app/internal/window/os_x11.go
@@ -42,8 +42,9 @@ import (
	"gioui.org/io/system"
	"gioui.org/unit"

	"gioui.org/app/internal/xkb"
	syscall "golang.org/x/sys/unix"

	"gioui.org/app/internal/xkb"
)

type x11Window struct {
diff --git a/font/gofont/gofont.go b/font/gofont/gofont.go
index 32f4b0e..9479439 100644
--- a/font/gofont/gofont.go
+++ b/font/gofont/gofont.go
@@ -11,8 +11,6 @@ import (
	"fmt"
	"sync"

	"gioui.org/font/opentype"
	"gioui.org/text"
	"golang.org/x/image/font/gofont/gobold"
	"golang.org/x/image/font/gofont/gobolditalic"
	"golang.org/x/image/font/gofont/goitalic"
@@ -25,6 +23,9 @@ import (
	"golang.org/x/image/font/gofont/goregular"
	"golang.org/x/image/font/gofont/gosmallcaps"
	"golang.org/x/image/font/gofont/gosmallcapsitalic"

	"gioui.org/font/opentype"
	"gioui.org/text"
)

var (
diff --git a/font/opentype/opentype.go b/font/opentype/opentype.go
index 17732d2..8f522be 100644
--- a/font/opentype/opentype.go
+++ b/font/opentype/opentype.go
@@ -10,13 +10,14 @@ import (
	"unicode"
	"unicode/utf8"

	"golang.org/x/image/font"
	"golang.org/x/image/font/sfnt"
	"golang.org/x/image/math/fixed"

	"gioui.org/f32"
	"gioui.org/op"
	"gioui.org/op/clip"
	"gioui.org/text"
	"golang.org/x/image/font"
	"golang.org/x/image/font/sfnt"
	"golang.org/x/image/math/fixed"
)

// Font implements text.Face. Its methods are safe to use
diff --git a/font/opentype/opentype_test.go b/font/opentype/opentype_test.go
index bd8da79..fd3091d 100644
--- a/font/opentype/opentype_test.go
+++ b/font/opentype/opentype_test.go
@@ -10,13 +10,14 @@ import (
	"strings"
	"testing"

	"gioui.org/internal/ops"
	"gioui.org/op"
	"gioui.org/text"
	"golang.org/x/image/font"
	"golang.org/x/image/font/gofont/goregular"
	"golang.org/x/image/font/sfnt"
	"golang.org/x/image/math/fixed"

	"gioui.org/internal/ops"
	"gioui.org/op"
	"gioui.org/text"
)

func TestCollectionAsFace(t *testing.T) {
diff --git a/internal/d3dcompile/compile_windows.go b/internal/d3dcompile/compile_windows.go
index 4766be7..1555acc 100644
--- a/internal/d3dcompile/compile_windows.go
+++ b/internal/d3dcompile/compile_windows.go
@@ -4,9 +4,8 @@ package d3dcompile

import (
	"fmt"
	"unsafe"

	"syscall"
	"unsafe"

	gunsafe "gioui.org/internal/unsafe"

diff --git a/internal/rendertest/clip_test.go b/internal/rendertest/clip_test.go
index a92cda8..29cb8a3 100644
--- a/internal/rendertest/clip_test.go
+++ b/internal/rendertest/clip_test.go
@@ -5,11 +5,12 @@ import (
	"math"
	"testing"

	"golang.org/x/image/colornames"

	"gioui.org/f32"
	"gioui.org/op"
	"gioui.org/op/clip"
	"gioui.org/op/paint"
	"golang.org/x/image/colornames"
)

func TestPaintRect(t *testing.T) {
diff --git a/internal/rendertest/render_test.go b/internal/rendertest/render_test.go
index eecac8f..58a8bd2 100644
--- a/internal/rendertest/render_test.go
+++ b/internal/rendertest/render_test.go
@@ -6,12 +6,13 @@ import (
	"math"
	"testing"

	"golang.org/x/image/colornames"

	"gioui.org/f32"
	"gioui.org/internal/f32color"
	"gioui.org/op"
	"gioui.org/op/clip"
	"gioui.org/op/paint"
	"golang.org/x/image/colornames"
)

func TestTransformMacro(t *testing.T) {
diff --git a/internal/rendertest/transform_test.go b/internal/rendertest/transform_test.go
index 27e4991..86c5454 100644
--- a/internal/rendertest/transform_test.go
+++ b/internal/rendertest/transform_test.go
@@ -5,11 +5,12 @@ import (
	"math"
	"testing"

	"golang.org/x/image/colornames"

	"gioui.org/f32"
	"gioui.org/op"
	"gioui.org/op/clip"
	"gioui.org/op/paint"
	"golang.org/x/image/colornames"
)

func TestPaintOffset(t *testing.T) {
diff --git a/internal/rendertest/util_test.go b/internal/rendertest/util_test.go
index 6568ace..591dd0a 100644
--- a/internal/rendertest/util_test.go
+++ b/internal/rendertest/util_test.go
@@ -13,12 +13,13 @@ import (
	"strconv"
	"testing"

	"golang.org/x/image/colornames"

	"gioui.org/app/headless"
	"gioui.org/f32"
	"gioui.org/internal/f32color"
	"gioui.org/op"
	"gioui.org/op/paint"
	"golang.org/x/image/colornames"
)

var (
diff --git a/text/lru.go b/text/lru.go
index 85dbf9c..ada028a 100644
--- a/text/lru.go
+++ b/text/lru.go
@@ -3,8 +3,9 @@
package text

import (
	"gioui.org/op"
	"golang.org/x/image/math/fixed"

	"gioui.org/op"
)

type layoutCache struct {
diff --git a/text/shaper.go b/text/shaper.go
index 71d7301..fee7ab1 100644
--- a/text/shaper.go
+++ b/text/shaper.go
@@ -6,8 +6,9 @@ import (
	"io"
	"strings"

	"gioui.org/op"
	"golang.org/x/image/math/fixed"

	"gioui.org/op"
)

// Shaper implements layout and shaping of text.
diff --git a/text/text.go b/text/text.go
index ed8695f..aa14bdf 100644
--- a/text/text.go
+++ b/text/text.go
@@ -5,8 +5,9 @@ package text
import (
	"io"

	"gioui.org/op"
	"golang.org/x/image/math/fixed"

	"gioui.org/op"
)

// A Line contains the measurements of a line of text.
diff --git a/widget/icon.go b/widget/icon.go
index 846c622..f6f88d3 100644
--- a/widget/icon.go
+++ b/widget/icon.go
@@ -7,11 +7,12 @@ import (
	"image/color"
	"image/draw"

	"golang.org/x/exp/shiny/iconvg"

	"gioui.org/internal/f32color"
	"gioui.org/layout"
	"gioui.org/op/paint"
	"gioui.org/unit"
	"golang.org/x/exp/shiny/iconvg"
)

type Icon struct {
diff --git a/widget/material/theme.go b/widget/material/theme.go
index 8cc44c7..5b3e627 100644
--- a/widget/material/theme.go
+++ b/widget/material/theme.go
@@ -5,10 +5,11 @@ package material
import (
	"image/color"

	"golang.org/x/exp/shiny/materialdesign/icons"

	"gioui.org/text"
	"gioui.org/unit"
	"gioui.org/widget"
	"golang.org/x/exp/shiny/materialdesign/icons"
)

// Palette contains the minimal set of colors that a widget may need to
-- 
2.26.2
Details
Message ID
<C7UWEP8PS7D4.2JZ62BTBETI05@testmac>
In-Reply-To
<160817579124.14978.2030286403566358290-0@git.sr.ht> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
Thanks, applied.
Details
Message ID
<CAE_4BPBzh1iT9eepaGRsrF=eMT5s4kUMypMVg+-EfQBvCx8TQw@mail.gmail.com>
In-Reply-To
<C7UWEP8PS7D4.2JZ62BTBETI05@testmac> (view parent)
DKIM signature
missing
Download raw message
I see this has already been applied, but I still want to ask: What's
the motivation behind this patch?  To me, trying to dink around with
the order or spacing of imports is wasted effort.  What value do we
get from trying to carefully curate that?  It seems like actively
rejecting or working against the uniformity brought by
gofmt/goimports.

-- L

On Thu, Dec 17, 2020 at 2:56 AM Elias Naur <mail@eliasnaur.com> wrote:
>
> Thanks, applied.
Details
Message ID
<C7ZPJ1P1NXF4.37VSIW4ET2RJZ@testmac>
In-Reply-To
<CAE_4BPBzh1iT9eepaGRsrF=eMT5s4kUMypMVg+-EfQBvCx8TQw@mail.gmail.com> (view parent)
DKIM signature
pass
Download raw message
On Tue Dec 22, 2020 at 5:50 PM CET, Larry Clapp wrote:
> I see this has already been applied, but I still want to ask: What's
> the motivation behind this patch? To me, trying to dink around with
> the order or spacing of imports is wasted effort. What value do we
> get from trying to carefully curate that? It seems like actively
> rejecting or working against the uniformity brought by
> gofmt/goimports.
>

I can't answer your question. I merged it because someone cared enough
to prepare a patch; I almost never look at imports.

Elias
Reply to thread Export thread (mbox)