GORM Playground Link

https://github.com/go-gorm/playground/pull/584

Description

I set id column read-only, but succesfully update it's value using OnConflict clause.

From the document:

Name string gorm:"<-:false" // allow read, disable write permission

I'm not sure whether it is acceptable case since DoUpdates clauses is set by user explicitly.

I don't investigate it further. It seems add a filter in ConvertToCreateValues can fix this, but it may cause compatibility issues if someone has used this behavior.

Comment From: Hanwn

Actually, ConvertToCreateValues function has removed the field without writing permission, but the clause DoUpdates will cause concating sql at the end when execute On conflict build clause(under preview)

https://github.com/go-gorm/gorm/blob/cc2d46e5be425300e064a39868cfdb333f24e4ac/callbacks/callbacks.go#L8

If you want update the field tagged by<-:false forcely, I think gorm will not ban it.