[GH-ISSUE #506] Install error - cannot convert b.borderAttributes #366

Closed
opened 2026-03-04 01:04:21 +03:00 by kerem · 19 comments
Owner

Originally created by @m-ivanov on GitHub (Sep 29, 2020).
Original GitHub issue: https://github.com/rivo/tview/issues/506

go get fails with following error

go get github.com/rivo/tview
# github.com/rivo/tview
Workspace/go/src/github.com/rivo/tview/box.go:343:63: cannot convert b.borderAttributes (type tcell.AttrMask) to type tcell.Style
Workspace/go/src/github.com/rivo/tview/table.go:331:108: cannot convert attributes (type tcell.AttrMask) to type tcell.Style
Workspace/go/src/github.com/rivo/tview/table.go:888:150: cannot convert cell.Attributes (type tcell.AttrMask) to type tcell.Style
Workspace/go/src/github.com/rivo/tview/table.go:957:63: cannot convert a (type tcell.AttrMask) to type tcell.Style
Workspace/go/src/github.com/rivo/tview/table.go:1020:24: invalid operation: t.selectedStyle != 0 (mismatched types tcell.Style and int)
Originally created by @m-ivanov on GitHub (Sep 29, 2020). Original GitHub issue: https://github.com/rivo/tview/issues/506 go get fails with following error ``` go get github.com/rivo/tview # github.com/rivo/tview Workspace/go/src/github.com/rivo/tview/box.go:343:63: cannot convert b.borderAttributes (type tcell.AttrMask) to type tcell.Style Workspace/go/src/github.com/rivo/tview/table.go:331:108: cannot convert attributes (type tcell.AttrMask) to type tcell.Style Workspace/go/src/github.com/rivo/tview/table.go:888:150: cannot convert cell.Attributes (type tcell.AttrMask) to type tcell.Style Workspace/go/src/github.com/rivo/tview/table.go:957:63: cannot convert a (type tcell.AttrMask) to type tcell.Style Workspace/go/src/github.com/rivo/tview/table.go:1020:24: invalid operation: t.selectedStyle != 0 (mismatched types tcell.Style and int) ```
kerem closed this issue 2026-03-04 01:04:21 +03:00
Author
Owner

@rivo commented on GitHub (Sep 30, 2020):

I'm not sure how you get this. I just tried it myself:

% go mod init gogettest
go: creating new go.mod: module gogettest
% go get github.com/rivo/tview
go: downloading github.com/rivo/tview v0.0.0-20200915114512-42866ecf6ca6
go: github.com/rivo/tview upgrade => v0.0.0-20200915114512-42866ecf6ca6

Works fine here. It seems that you're using a different/newer version of tcell as the tcell.Style type has been changed recently. I haven't gotten around to updating this module yet.

But as noted, it should work nonetheless because in go.mod, the tcell version is 1.3.0. And in tcell 1.3.0, Style is int64.

<!-- gh-comment-id:701518464 --> @rivo commented on GitHub (Sep 30, 2020): I'm not sure how you get this. I just tried it myself: ``` % go mod init gogettest go: creating new go.mod: module gogettest % go get github.com/rivo/tview go: downloading github.com/rivo/tview v0.0.0-20200915114512-42866ecf6ca6 go: github.com/rivo/tview upgrade => v0.0.0-20200915114512-42866ecf6ca6 ``` Works fine here. It seems that you're using a different/newer version of [`tcell`](https://github.com/gdamore/tcell) as the `tcell.Style` type has been changed recently. I haven't gotten around to updating this module yet. But as noted, it should work nonetheless because in `go.mod`, the `tcell` version is [1.3.0](https://github.com/rivo/tview/blob/42866ecf6ca6fc1361dc008f76eda11056ab4dc7/go.mod#L6). And in `tcell` 1.3.0, [`Style` is `int64`](https://github.com/gdamore/tcell/blob/4d152cc2622d491e1b0a034c3211b9df28c0ba2d/style.go#L35).
Author
Owner

@m-ivanov commented on GitHub (Sep 30, 2020):

i got that error whithout using modules, with works just fine. So the issue can be closed. maybe add a line to readme. Thanks for fast feedback

<!-- gh-comment-id:701592105 --> @m-ivanov commented on GitHub (Sep 30, 2020): i got that error whithout using modules, with works just fine. So the issue can be closed. maybe add a line to readme. Thanks for fast feedback
Author
Owner

@odddollar commented on GitHub (Oct 2, 2020):

I got the same error. How did people fix it?

<!-- gh-comment-id:702586395 --> @odddollar commented on GitHub (Oct 2, 2020): I got the same error. How did people fix it?
Author
Owner

@ledongthuc commented on GitHub (Oct 2, 2020):

@odddollar which Go version are you using? Maybe missing go modules in a package, it mismatch version dependencies

<!-- gh-comment-id:702889837 --> @ledongthuc commented on GitHub (Oct 2, 2020): @odddollar which Go version are you using? Maybe missing go modules in a package, it mismatch version dependencies
Author
Owner

@odddollar commented on GitHub (Oct 3, 2020):

I'm using go1.15

<!-- gh-comment-id:703008903 --> @odddollar commented on GitHub (Oct 3, 2020): I'm using go1.15
Author
Owner

@ledongthuc commented on GitHub (Oct 3, 2020):

@odddollar When you call go get github.com/rivo/tview, do you have any module in folder you stay?
If you call it from random folder without go.mod, it will got error because mismatch dependencies version

<!-- gh-comment-id:703059749 --> @ledongthuc commented on GitHub (Oct 3, 2020): @odddollar When you call ```go get github.com/rivo/tview```, do you have any module in folder you stay? If you call it from random folder without go.mod, it will got error because mismatch dependencies version
Author
Owner

@odddollar commented on GitHub (Oct 3, 2020):

I open the cmd from the start menu and run the command in the default location of cmd. I've never had any issues installing libraries like this before.

<!-- gh-comment-id:703061240 --> @odddollar commented on GitHub (Oct 3, 2020): I open the cmd from the start menu and run the command in the default location of cmd. I've never had any issues installing libraries like this before.
Author
Owner

@ledongthuc commented on GitHub (Oct 3, 2020):

@odddollar
It relates to dependencies linking.
The github.com/rivo/tview uses github.com/gdamore/tcell

When you build with folder that has go module, it will link with locked version of github.com/gdamore/tcell, thev1.3.0

But when you build with random folder without go.mod, unfortunally, it get the latest version of tcell, the 2.xx. It doesn't backward compatible with locked version v1.3.0 that github.com/rivo/tview are using.

<!-- gh-comment-id:703066526 --> @ledongthuc commented on GitHub (Oct 3, 2020): @odddollar It relates to dependencies linking. The `github.com/rivo/tview` uses `github.com/gdamore/tcell` When you build with folder that has go module, it will link with locked version of `github.com/gdamore/tcell`, thev1.3.0 But when you build with random folder without go.mod, unfortunally, it get the latest version of `tcell`, the 2.xx. It doesn't backward compatible with locked version v1.3.0 that `github.com/rivo/tview` are using.
Author
Owner

@afroewis commented on GitHub (Oct 4, 2020):

I am getting the same error when installing this library with a clean go installation (1.15).

C:\Users\afroewis\go\src\github.com\rivo\tview\box.go:343:63: cannot convert b.borderAttributes (type tcell.AttrMask) to type tcell.Style
C:\Users\afroewis\go\src\github.com\rivo\tview\table.go:331:108: cannot convert attributes (type tcell.AttrMask) to type tcell.Style
C:\Users\afroewis\go\src\github.com\rivo\tview\table.go:888:150: cannot convert cell.Attributes (type tcell.AttrMask) to type tcell.Style
C:\Users\afroewis\go\src\github.com\rivo\tview\table.go:957:63: cannot convert a (type tcell.AttrMask) to type tcell.Style
C:\Users\afroewis\go\src\github.com\rivo\tview\table.go:1020:24: invalid operation: t.selectedStyle != 0 (mismatched types tcell.Style and int)
<!-- gh-comment-id:703289471 --> @afroewis commented on GitHub (Oct 4, 2020): I am getting the same error when installing this library with a clean go installation (1.15). ``` C:\Users\afroewis\go\src\github.com\rivo\tview\box.go:343:63: cannot convert b.borderAttributes (type tcell.AttrMask) to type tcell.Style C:\Users\afroewis\go\src\github.com\rivo\tview\table.go:331:108: cannot convert attributes (type tcell.AttrMask) to type tcell.Style C:\Users\afroewis\go\src\github.com\rivo\tview\table.go:888:150: cannot convert cell.Attributes (type tcell.AttrMask) to type tcell.Style C:\Users\afroewis\go\src\github.com\rivo\tview\table.go:957:63: cannot convert a (type tcell.AttrMask) to type tcell.Style C:\Users\afroewis\go\src\github.com\rivo\tview\table.go:1020:24: invalid operation: t.selectedStyle != 0 (mismatched types tcell.Style and int) ```
Author
Owner

@ledongthuc commented on GitHub (Oct 4, 2020):

@afroewis yes, please install it in folder that has go.mod currently.

<!-- gh-comment-id:703289686 --> @ledongthuc commented on GitHub (Oct 4, 2020): @afroewis yes, please install it in folder that has go.mod currently.
Author
Owner

@rivo commented on GitHub (Oct 15, 2020):

I can bump tcell to the latest version but I'm not yet sure if I should. The latest version is v2.0.0-dev and the "dev" part looks to me like there may be more breaking changes coming up.

Even if I upgraded to v2.0.0-dev now, it would break tview as well (but only in one function, from what I can see upon a quick glance, so maybe it's not that bad).

But generally, as some of you maybe have seen here already, I don't want to break backwards compatibility. It would be unfortunate if tcell forced me to. @gdamore, could you maybe weigh in? Do you plan on making more breaking changes like the one to tcell.Style?

<!-- gh-comment-id:709306064 --> @rivo commented on GitHub (Oct 15, 2020): I can bump `tcell` to the latest version but I'm not yet sure if I should. The latest version is [v2.0.0-dev](https://github.com/gdamore/tcell/releases/tag/v2.0.0-dev) and the "dev" part looks to me like there may be more breaking changes coming up. Even if I upgraded to v2.0.0-dev now, it would break `tview` as well (but only in [one function](https://pkg.go.dev/github.com/rivo/tview#TableCell.SetStyle), from what I can see upon a quick glance, so maybe it's not that bad). But generally, as some of you maybe have seen here already, I don't want to break backwards compatibility. It would be unfortunate if `tcell` forced me to. @gdamore, could you maybe weigh in? Do you plan on making more breaking changes like the one to `tcell.Style`?
Author
Owner

@gdamore commented on GitHub (Oct 15, 2020):

I don’t plan anything else breaking. The one thing still left to do is bracketed paste support. Once that is done I will tag for release. I plan to do that shortly. That change should not be incompatible with what’s already there.

Get Outlookhttps://aka.ms/qtex0l for iOS


From: rivo notifications@github.com
Sent: Thursday, October 15, 2020 5:56:36 AM
To: rivo/tview tview@noreply.github.com
Cc: gdamore garrett@damore.org; Mention mention@noreply.github.com
Subject: Re: [rivo/tview] Install error - cannot convert b.borderAttributes (#506)

I can bump tcell to the latest version but I'm not yet sure if I should. The latest version is v2.0.0-devhttps://github.com/gdamore/tcell/releases/tag/v2.0.0-dev and the "dev" part looks to me like there may be more breaking changes coming up.

Even if I upgraded to v2.0.0-dev now, it would break tview as well (but only in one functionhttps://pkg.go.dev/github.com/rivo/tview#TableCell.SetStyle, from what I can see upon a quick glance, so maybe it's not that bad).

But generally, as some of you maybe have seen here already, I don't want to break backwards compatibility. It would be unfortunate if tview forced me to. @gdamorehttps://github.com/gdamore, could you maybe weigh in? Do you plan on making more breaking changes like the one to tcell.Style?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/rivo/tview/issues/506#issuecomment-709306064, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAJ4G7OIX33MY2JDJIURDOLSK3WQJANCNFSM4R6KM4AQ.

<!-- gh-comment-id:709357917 --> @gdamore commented on GitHub (Oct 15, 2020): I don’t plan anything else breaking. The one thing still left to do is bracketed paste support. Once that is done I will tag for release. I plan to do that shortly. That change should not be incompatible with what’s already there. Get Outlook<https://aka.ms/qtex0l> for iOS ________________________________ From: rivo <notifications@github.com> Sent: Thursday, October 15, 2020 5:56:36 AM To: rivo/tview <tview@noreply.github.com> Cc: gdamore <garrett@damore.org>; Mention <mention@noreply.github.com> Subject: Re: [rivo/tview] Install error - cannot convert b.borderAttributes (#506) I can bump tcell to the latest version but I'm not yet sure if I should. The latest version is v2.0.0-dev<https://github.com/gdamore/tcell/releases/tag/v2.0.0-dev> and the "dev" part looks to me like there may be more breaking changes coming up. Even if I upgraded to v2.0.0-dev now, it would break tview as well (but only in one function<https://pkg.go.dev/github.com/rivo/tview#TableCell.SetStyle>, from what I can see upon a quick glance, so maybe it's not that bad). But generally, as some of you maybe have seen here already, I don't want to break backwards compatibility. It would be unfortunate if tview forced me to. @gdamore<https://github.com/gdamore>, could you maybe weigh in? Do you plan on making more breaking changes like the one to tcell.Style? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub<https://github.com/rivo/tview/issues/506#issuecomment-709306064>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAJ4G7OIX33MY2JDJIURDOLSK3WQJANCNFSM4R6KM4AQ>.
Author
Owner

@rivo commented on GitHub (Oct 15, 2020):

Thanks, @gdamore ! I'll upgrade tview to the latest version then.

<!-- gh-comment-id:709405131 --> @rivo commented on GitHub (Oct 15, 2020): Thanks, @gdamore ! I'll upgrade `tview` to the latest version then.
Author
Owner

@gdamore commented on GitHub (Oct 15, 2020):

Be advised that in formal v2, you may get some new events which aren't defined yet. Make sure that won't break your code. It shouldn't, and I don't consider it a breaking change, except that folks may have code that can't cope with receiving an event type that they didn't code to handle.

<!-- gh-comment-id:709417915 --> @gdamore commented on GitHub (Oct 15, 2020): Be advised that in formal v2, you may get some new events which aren't defined yet. Make sure that won't break your code. It shouldn't, and I don't consider it a breaking change, except that folks may have code that can't cope with receiving an event type that they didn't code to handle.
Author
Owner

@gdamore commented on GitHub (Oct 15, 2020):

(I'm specifically planning for EventPasteStart, EventPasteEnd type of events.)

<!-- gh-comment-id:709418142 --> @gdamore commented on GitHub (Oct 15, 2020): (I'm specifically planning for EventPasteStart, EventPasteEnd type of events.)
Author
Owner

@rivo commented on GitHub (Oct 16, 2020):

New events should be fine.

Regarding Style, I'm using AttrMask in a few places. Would it be possible to add a SetAttr(attr AttrMask) function to the Style type? Otherwise, I may have to decompose AttrMask and call all of the functions such as Style.Bold() myself.

<!-- gh-comment-id:709978020 --> @rivo commented on GitHub (Oct 16, 2020): New events should be fine. Regarding `Style`, I'm using `AttrMask` in a few places. Would it be possible to add a `SetAttr(attr AttrMask)` function to the `Style` type? Otherwise, I may have to decompose `AttrMask` and call all of the functions such as `Style.Bold()` myself.
Author
Owner

@gdamore commented on GitHub (Oct 16, 2020):

Sounds reasonable to me. Do you want to submit a PR?

<!-- gh-comment-id:710081391 --> @gdamore commented on GitHub (Oct 16, 2020): Sounds reasonable to me. Do you want to submit a PR?
Author
Owner

@gdamore commented on GitHub (Oct 16, 2020):

Btw v2 is now released.

<!-- gh-comment-id:710081669 --> @gdamore commented on GitHub (Oct 16, 2020): Btw v2 is now released.
Author
Owner

@rivo commented on GitHub (Oct 18, 2020):

Everybody, I've upgraded tview to the latest tcell version. Due to the changes in tcell, the TableCell.SetStyle() function has changed. I hope this doesn't break too many systems.

I believe this should make tview work without modules again.

<!-- gh-comment-id:711160092 --> @rivo commented on GitHub (Oct 18, 2020): Everybody, I've upgraded `tview` to the latest `tcell` version. Due to the changes in `tcell`, the [`TableCell.SetStyle()`](https://pkg.go.dev/github.com/rivo/tview#TableCell.SetStyle) function has changed. I hope this doesn't break too many systems. I believe this should make `tview` work without modules again.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#366
No description provided.